2013-04-28 22 views
0

我想使用Jquery Draggable,但当目标物品被抬起然后掉落,悬停在其旧位置或从其容器中取出时,我发现闪烁。拖动的div中的图像会消失或出现在错误的位置(它应该始终在拖动时显示在同一位置 - 正如您所期望的那样)。JQuery Draggable(包括小提琴)的毛病行为

任何想法如何可以纠正?

我的代码:

http://jsfiddle.net/PTSkR/28/

$(function() { 
      $('#container').isotope({ 
       // options 
       itemSelector: '.study-box', 
       layoutMode: 'fitRows' 
      }); 
     }); 

     $(function() { 
      $(".study-box").draggable({ 
       revert: "invalid", 
       helper: function() { 
        // We removeAttr('style') to get rid of the transform css that isotope added. 
        return $(this).clone().removeAttr('style').removeClass('isotope-item').addClass('drag-helper').appendTo('body'); 
       }, 
       start: function() { 
        $(this).hide(); 
       }, 
       stop: function() { 
        $(this).show(); 
       }, 
       zIndex: 100 
      }); 
     }); 
     $(function() { 
      $(".folder-box").draggable({ revert: "invalid" }); 
      $(".folder-box").droppable({ 
       // revert: "invalid", 
       accept: ".folder-box, .set-box", 
       drop: function (event, ui) { 
        var $this = $(this); 
        //ui.draggable.clone().removeAttr('style').removeClass('.folder-box').appendTo($this); 
        $('#container').isotope('remove', ui.draggable); 
       } 
      }); 
     }); 

回答

0

有什么不妥的JavaScript是,只是删除所有 “的位置是:固定” 在CSS。这是摆脱背景位置正确的显示。