admin管理员组文章数量:1335357
I have a widget-like system with widgets that are able to be dragged around (with jQuery draggable/sortable). The problem is now that when a user drags one of those widgets and moves the cursor on the edge, the parent div scrolls to the direction of the cursor.
A simplified layout is as follows:
<div id="wrapper" style="width:WINDOW_WIDTH;">
<div id="page_wrapper" style="width:10000px;">
<div class="widget_page" style="width:WINDOW_WIDTH;">
<div class="widget draggable"></div>
<div class="widget draggable"></div>
<div class="widget draggable"></div>
</div>
<div class="widget_page" style="width:WINDOW_WIDTH;">
<div class="widget draggable"></div>
<div class="widget draggable"></div>
<div class="widget draggable"></div>
</div>
</div>
</div>
is there any way i can disable the page_wrapper from scrolling?
I have a widget-like system with widgets that are able to be dragged around (with jQuery draggable/sortable). The problem is now that when a user drags one of those widgets and moves the cursor on the edge, the parent div scrolls to the direction of the cursor.
A simplified layout is as follows:
<div id="wrapper" style="width:WINDOW_WIDTH;">
<div id="page_wrapper" style="width:10000px;">
<div class="widget_page" style="width:WINDOW_WIDTH;">
<div class="widget draggable"></div>
<div class="widget draggable"></div>
<div class="widget draggable"></div>
</div>
<div class="widget_page" style="width:WINDOW_WIDTH;">
<div class="widget draggable"></div>
<div class="widget draggable"></div>
<div class="widget draggable"></div>
</div>
</div>
</div>
is there any way i can disable the page_wrapper from scrolling?
Share Improve this question asked Feb 7, 2012 at 12:21 Bart ZweersBart Zweers 1172 silver badges6 bronze badges2 Answers
Reset to default 4Try to add overflow:hidden;
in the css of the page_wrapper.
just add css property "position as a static" on parent div for which you set the scrollbar.
$("selector").css("position","static");
ex.
$('.bottomSentences').draggable({
cursor: 'move',
helper: 'clone',
start: function(e, ui)
{
$(ui.helper).addClass("ui-draggable-helper");
$("#splitSentencesDiv").css("position","static");
}
});
here in ex. splitSentencesDiv is my Div for which i set the scroll. by default its position value is relative set by bootstrap col- class.
本文标签: Javascript (jQuery) disable page scroll when dragging itemsStack Overflow
版权声明:本文标题:Javascript (jQuery) disable page scroll when dragging items - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742337815a2455981.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论