jquery - How to stop an overflow div scroll down when drag an element out of it?
I have two divs: one top, one bottom. Top div has overflow: auto and a scrollbar. When I drag element from top div to bottom div, the scrollbar auto scroll down. I know this is a normal behaviour but I want to stop that.
Screenshot: http://img819.imageshack.us/img819/5235/simpl开发者_开发百科ezttpleditor.jpg
onDragStart,
$('#topDivId').css({overflow: 'hidden'});
onDragEnd,
$('#topDivId').css({overflow: 'auto'});
Just set overflow to hidden while dragging.
I just had a quick play around with a similar situation and came up with a hacky solution:
onDragStart: Make the item absolutely positioned and a child of the body element. It then moves over the top of everything else.
onDragEnd: Add the item back to the correct parent and make it relatively positioned again.
Not sure if this helps in your situation but it works in Safari for me.
加载中,请稍侯......
精彩评论