开发者

Jquery: Draggable bug

My drag element is positioned relative to its parent that is also positioned relative (such positions are a开发者_JAVA技巧 must). I set containment to 'parent'. When I drag the element and scroll at the same time, the drag element goes out of its parent. Is that jQuery's bug? How to fix it? Setting 'scroll' to 'false' does change anything.


I got the same problem but I fixed it by using:

$(window).scroll(function(){
    if( $('#draggable').offset().top < $("#droppable").offset().top)
        $("#draggable").animate({top: 0}, "fast");
});

I use event scroll to check position when scrolling. If the position of the dragged element is less than the drop area, I will set a new position.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜