jQuery UI sortable scroll helper element offset Firefox issue jQuery UI sortable scroll helper element offset Firefox issue jquery jquery

jQuery UI sortable scroll helper element offset Firefox issue


If you want to prevent browser sniffing, the CSS only solution is to set the ul or a container style to overflow: auto. If you look at the source through firebug, it's the way jQuery does it in their example.


Using overflow: auto; was not an option for me. I was able to work around this issue with this sort event handler:

$(...).sortable({    ...    sort: function(event, ui) {        var $target = $(event.target);        if (!/html|body/i.test($target.offsetParent()[0].tagName)) {            var top = event.pageY - $target.offsetParent().offset().top - (ui.helper.outerHeight(true) / 2);            ui.helper.css({'top' : top + 'px'});        }    },    ...});

It is not perfect, but it doesn't require browser sniffing. Tested in IE8, Chrome and Firefox.

Edit: This is using jQuery 1.10.0 and jQuery UI 1.10.3.


I was seeing this issue and was able to solve it by removing the css rule position:relative from one of the containing divs on my page. See also: http://forum.jquery.com/topic/sortable-offset-when-element-is-dragged-and-page-scrolled-down-ff