滚动时jQuery UI拖放问题 [英] jQuery UI drag and drop issue with scroll

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

问题描述

点击某些文字时,我有一个div-pop-up。我希望它可以移动,所以我使用了jQuery UI draggable()功能,就像一个魅力。但是,我遇到的问题是在弹出窗口中有一个div。我正在显示一个数组的信息,如果需要,可以在0到几乎无穷大的范围内。因此我使用 overflow:auto 将其设置为滚动框。但是,当我单击向上和向下箭头在该框中向上和向下滚动时,它会显示为可拖动的功能。这是相当恼人的,并理解为什么问题发生。我正在寻找建议来解决它或以某种方式解决它。

I have a div-pop-up when you click certain text. I want it to be movable so I used the jQuery UI draggable() feature and works like a charm. However, the issue I am having is with a div within this pop up. I am displaying information from an array that can range from 0 to nearly infinity if needed. Therefore I am using overflow:auto to make it into a scroll box. Everything appears as it should however, when I click the up and down arrows to scroll up and down within that box it instead begins the draggable feature. It is rather annoying and understand why the problem is happening. I am looking for advice to fix it or get around it somehow.

这是一个显示问题的jsfiddle: http://jsfiddle.net/BnTPG/

Here is a jsfiddle to display the issue: http://jsfiddle.net/BnTPG/

推荐答案

你可以使用句柄选项。看一下(我修改了你的小提琴)。在我的例子中,我将标题设置为draggable的句柄,我使用了一些id而不是你所做的类。

You can use the handle option. Take a look (I modified your fiddle). In my example, I set the title as the handle of the draggable and I used some ids instead of the classes as you did.

http://jsfiddle.net/BnTPG/2/

我想你有这个问题,因为你正在使用相对和绝对定位(这只是猜测,我没有测试过这个)。

I think you are having this problem because you are using relative and absolute positioning (it's just a guess, I didn't tested this).

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

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