jQuery拖动/滚动/溢出问题 [英] JQuery drag/scrolling/overflow issue

查看:117
本文介绍了jQuery拖动/滚动/溢出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JQuery 1.4.2和JQuery 1.7.2的scrolling:auto问题.我有一个包含2个DIV的容器DIV.像这样:

I have a scrolling:auto problem with JQuery 1.4.2 and JQuery 1.7.2. I have a container DIV with 2 DIVs inside it. Like this:

<div id="dragContain">

<div id="dragMe">
  <div>Title goes here!</div>
  <div style="scrolling:auto;">Content goes here!</div>
</div>

</div>

并且我可以通过以下方式拖动组:

And I enable dragging the group by:

$('#dragMe').draggable({
  containment: '#dragContain', cursor: 'move', zIndex: 20000
});

而且,当我这样做时,在FF中,滚动仅适用于鼠标滚轮.抓住滚动条会导致拖动事件并移动组.在IE中可以正常工作.

And, when I do so, in FF the scrolling only works with the mouse wheel. Grabbing the scrollbar causes a drag event and moves the group. It works fine in IE.

有什么办法可以纠正这个问题?我可以仅将标题栏设置为会导致父div拖动的抓手柄吗?

Is there any way to correct this? Can I make only the titlebar a grab handle which causes a drag on the parent div?

谢谢!

推荐答案

您可以尝试使用句柄.因此,用户可以拖放h2元素,而不是整个#dragMe.

You could try using a handle instead. So the user would drag and drop the h2 element instead of the whole of #dragMe.

$('#dragMe').draggable({
  containment: '#dragContain', cursor: 'move', zIndex: 20000, handle: 'h2'
});

.

<div id="dragContain">

<div id="dragMe">
  <h2>Title goes here!</h2>
  <div style="scrolling:auto;">Content goes here!</div>
</div>

</div>

这篇关于jQuery拖动/滚动/溢出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆