jQuery UI sortable scroll helper element offset Firefox issue

前端 未结 15 2281
故里飘歌
故里飘歌 2020-12-07 22:32

I have a problem with a jQuery UI 1.7.2 sortable list in Firefox 3.6, IE7-8 work fine. When I\'m scrolled down a bit, the helper element seems to have an offset of the same

15条回答
  •  独厮守ぢ
    2020-12-07 22:41

    You also need to account for the fact this is specific to firefox, here is the snippet I'm using - I got directed the right way from Harris' solution. I encountered this problem w/o using the helper when the sortable was in a relatively positioned container.

      var options = { 
       handle: '.mover', 
       update:updateSorting 
     };
      var userAgent = navigator.userAgent.toLowerCase();
      if(userAgent.match(/firefox/)) {
        options["start"] = function (event, ui) { ui.item.css('margin-top', $(window).scrollTop() ); };
        options["beforeStop"] = function (event, ui) { ui.item.css('margin-top', 0 ); };
      }
      $("#" + list_id+"").sortable(options);
      $("#" + list_id+"").disableSelection();
    

    You could also do this check on the server and then have 2 different calls depending on the browser.

提交回复
热议问题