2011-02-14 59 views
0

我意识到我在Chrome中存在jQuery Draggable的bug,这在Firefox和Internet Explorer中不存在。里面有div#drag-container/450x80 /​​和3个可拖动的对象。/150x0 /当我将它们移动到最低点时,让它们再次拖动LOWER,它们会获得位置0,80 + 14 = 0.94 px。我让他们拖动,他们再次降低了14倍。jQuery Draggable - 走出遏制 - Chrome Bug

是否有修复?

工作演示:http://jsfiddle.net/ucmqq/ 这里是代码:

<style> 
    .draggable { width: 150px; height: 0px; cursor:move; } 
    <?PHP if($userinfo->use_colors != '0'): ?> 
    #drag-container { width: 450px; height:80px; background-color:<?=$userinfo->background?>; } 
    <?PHP else: ?> 
    #drag-container { width: 450px; height:80px; background:url(/backgrounds/<?=$userinfo->image?>); } 
    <?PHP endif; ?> 
    </style> 

    <script language="javascript"> 

    $(function() { 
     $("#draggable").draggable({ cursor: "move",containment: 'parent', scroll: false, 
     stop: function() { 
     document.settings.np_x.value = $(this).css('left'); 
     document.settings.np_y.value = $(this).css('top'); 
     } 
            }); 
     $("#draggable2").draggable({ cursor: "move",containment: 'parent', scroll: false , 
     stop: function() { 
     document.settings.artist_x.value = $(this).css('left'); 
     document.settings.artist_y.value = $(this).css('top'); 
     } 
            }); 
     $("#draggable3").draggable({ cursor: "move",containment: 'parent', scroll: false , 
     stop: function() { 
     document.settings.other_x.value = $(this).css('left'); 
     document.settings.other_y.value = $(this).css('top'); 
     } 
            }); 
    }); 

    </script> 


<div id="drag-container"> 
    <div id="draggable" class="draggable" style="position:relative;top:5px;left:80px;"> 
     .::[ NowPlaying SIGnature ]::. 
    </div> 
    <div id="draggable2" class="draggable" style="position:relative;top:25px;left:80px;"> 
     Artist - title 
    </div> 
    <div id="draggable3" class="draggable" style="position:relative;top:45px;left:80px;"> 
     Album: (Year) 
     <br> 
     Genre: 
    </div> 

</div> 

回答

1

的问题是,拖动对象的高度为0。身高1再次它的马车,但没有身高在所有它的确定。

0

我有同样的错误,但在我的情况下没有可拖动元素的高度。在我的例子中,我使用了bootstrap,并试图将元素拖动到不同的div上。问题在于col-md-3的css float属性。所以我不得不删除它,并使用display: inline-block; vertical-align: top;

也许它会帮助别人。