可以点击jquerydraggableparent开始拖动吗?
我有这样的标记
<div id="colorpicker-background">
<div id="colorpicker-selector"></div>
</div>
使用这样的JS:
$('#colorpicker-selector').draggable({
containment : $('#colorpicker-background'),
handle : $('#colorpicker-selector')
})
当用户 onmousedown
在 #colorpicker-background
上触发时,我将 #colorpicker-selector
移动到鼠标按下是。问题是,即使选择器现在位于光标下方,用户也无法继续拖动。
我已经尝试根据我读过的各种帖子在 #colorpicker-selector
上触发 Drag、dragstart、mousedown、mousedown.draggable,但没有运气。
这里的另一个用户也遇到了同样的问题,但这是 6 个月前的问题,没有答案,而且 jQuery 版本不同(因为从那时起有很多更新): jquery 在点击另一个时开始拖动对象
I have markup like this
<div id="colorpicker-background">
<div id="colorpicker-selector"></div>
</div>
With JS like this:
$('#colorpicker-selector').draggable({
containment : $('#colorpicker-background'),
handle : $('#colorpicker-selector')
})
When the user onmousedown
fires on #colorpicker-background
I move #colorpicker-selector
to where the mousedown is. The problem is, the user can't continue to drag even though the selector is now under the cursor.
I have tried triggering drag, dragstart, mousedown, mousedown.draggable on #colorpicker-selector
based on all sorts of posts I've read and am having no luck.
Another user here has had the same problem, but it's from 6 months ago, with no answer, and different jQuery versions ( as there have been many updates since then ): jquery start dragging object when clicked on the other
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
mousedown
上,我绑定了函数updateSelector
On
mousedown
I bind the functionupdateSelector