Jquery Portlet水平滚动问题
使用可排序 portlet 拖动项目时如何防止水平滚动? 目前,当您拖动项目时,您可以不受任何限制地向右滚动,如演示中所示: http: //jqueryui.com/demos/sortable/#portlets
编辑:我刚刚注意到,当您垂直拖动元素时,会发生同样的事情,它会永远持续下去。有什么办法可以为滚动添加某种边界吗?
谢谢。
How can I prevent horizontal scrolling when dragging items using sortable portlets?
Currently when you drag an item, you can scroll to the right without any limits as seen in the demo: http://jqueryui.com/demos/sortable/#portlets
EDIT: I just noticed that the same thing happens when you drag the element vertically, it just goes on forever. Any way to add some kind of boundaries to the scrolling?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
轴:“y”
Use
axis: "y"
我从未使用过可排序,但我编写了代码来限制滚动到某个区域,所以也许您可以看一下这段代码并弄清楚该怎么做。
对于水平滚动,请查看 http://api.jquery.com/scrollLeft/
I've never used sortable, but I've written code to restrict scrolling to a certain area so maybe you can take a look at this code and figure out what to do.
For horizontal scrolling, look at http://api.jquery.com/scrollLeft/
您可以使用
containment
(链接到API)。您可以编写如下内容:这会将您的 portlet 锁定在 body 元素中。您还可以使用选择器或其他特殊单词来选择将 portlet 锁定到的内容。只需确保包含元素在显示时具有高度即可。
You can use
containment
(Link to the API). You can write something like this:This will lock your portlets in the body element. You can also use selectors or other special words to choose what the portlets are locked into. Just make sure that the containment elements have a height when they're displayed.