jQuery-UI Draggable:如何将可拖动元素悬停在div上时使其滚动div [英] Jquery-ui draggable: how to make a draggable element scroll a div when hovering over it

查看:134
本文介绍了jQuery-UI Draggable:如何将可拖动元素悬停在div上时使其滚动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆可拖动的元素,接收它们的可放置元素在div中,该div设置为溢出-y:滚动.

I've got a bunch of draggable elements, and the droppable elements that receive them are in a div that is set to overflow-y: scroll.

draggable的'scroll'选项可以滚动整个页面,但是我无法滚动它来拖动droppable的父div.我尝试将可拖动对象的包含属性更改为悬停时可放置对象的父对象,但这也不起作用.

The 'scroll' option of draggable works to scroll the whole page, but I cannot get it to scroll the parent div of the droppables. I've tried changing the containment attribute of the draggable to be the droppables' parent on hover, but that doesn't work either.

如果有人知道这样做的方法,我将不胜感激. 这是我要执行的操作的基本思路: http://jsfiddle.net/4gMVf/5//

If anyone knows of a way to do this, I'd greatly appreciate it. Here's the basic idea of what I'm trying to do: http://jsfiddle.net/4gMVf/5/

推荐答案

分叉了小提琴,然后放在这个漂亮的解决方案中.

查看: http://jsfiddle.net/crowjonah/Fr7u8/2/ 有几个锚点区域,当它们拖到上方时,它们会自动滚动可放置对象.

Check it out: http://jsfiddle.net/crowjonah/Fr7u8/2/ There are a couple anchor areas that, when dragged over, will autoscroll the droppable.

我和他一样,给了锚一些可见性,以便您了解锚的工作方式.您很可能希望它们对于最终使用完全透明.

I, like him, gave the anchors some visibility so you can see how they're working. You'll most likely want them totally transparent for end use.

我不确定,但是您的可放式对象似乎还存在其他问题,因为它似乎不接受您的可拖动对象,但是既然那不是您的问题,我就赢了不要尝试解决这个问题.

I can't be sure, but it seems like you've got some other issues with your droppable, though, as it doesn't seem to be accepting your draggables, but since that wasn't your question, I won't try and solve that problem.

这篇关于jQuery-UI Draggable:如何将可拖动元素悬停在div上时使其滚动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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