为 jQuery UI Draggable() 设置超时以防止锁定效果
我正在使用draggable(),但有时draggable()似乎会产生锁定效果,即使释放鼠标按钮后拖动效果仍然存在。 一旦发生这种情况,唯一的解决办法就是刷新页面,这对于基于 ajax 的网站来说是一种糟糕的方法。
因此,使用 UI 文档 我试图找到一种设置超时的方法当拖动开始时,如果在x秒内拖动没有完成,则将调用dragstop事件。
我想这并不难,但到目前为止我还无法实现。 任何帮助将非常感激。
I'm using draggable(), but occasionally the draggable() seems to create a locking effect where the dragging effect persists even after the mouse button is released. Once this happens, the only fix is to refresh the page, which is a terrible way to go for an ajax-based site.
So using the UI docs I'm trying to figure out a way to set a timeout when dragging starts, so that if the dragging isn't finished within x seconds, then the dragstop event will be called.
I imagine this wouldn't be hard, but I haven't been able to implement it so far. Any help would be very much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不想建议这个,但我会花更多的时间试图理解为什么你不能让draggable正常工作,而不是询问在创可贴修复中进行黑客攻击......
i hate to suggest this, but I'd spend a little more time trying to understand out WHY you can't get draggable to work properly rather than asking about hacking in a bandaid fix...
尝试这样的事情:
Try something like this: