可通过可选文本进行排序
是否可以拥有可排序的元素,但仍然允许用户复制/粘贴元素内的文本?
<div class="sortable">
<div class="pseudo-sortable">Foo</div>
<div class="pseudo-sortable">Bar</div>
<div>other stuff that i don't care if a user
can't copy (maybe images or buttoms)</div>
</div>
我可以轻松做到:
$('.sortable').sortable({cancel: '.pseudo-sortable'});
这将允许我在浏览器中选择文本,并根据需要进行复制/粘贴。然而,这也使得该人无法拖/放。所以我想我想要的是从取消开始,但是如果鼠标在容器外移动一定距离,那么伪排序就不再被取消。这有道理吗?
如果这是不可能的,我的最后一个选择是应用一个触发器,在可排序和不可排序之间切换容器,以便它们可以选择文本,但我更愿意最小化 ui 点击次数。
Is it possible to be able to have sortable elements, but still allow users to copy/paste the text inside the elements?
<div class="sortable">
<div class="pseudo-sortable">Foo</div>
<div class="pseudo-sortable">Bar</div>
<div>other stuff that i don't care if a user
can't copy (maybe images or buttoms)</div>
</div>
I can easily do:
$('.sortable').sortable({cancel: '.pseudo-sortable'});
This will allow me to select the text in the browser and copy/paste if I want. However, this also makes it so that the person can't drag/drop. So I think what I'd like is to start off with the cancel but if the mouse goes a certain distance outside the container, then the pseudo-sortables are no longer canceled. Does that make sense?
If this is not possible my last option would be to apply a trigger that switches containers between sortable and non-sortable, so that they can select the text, but I'd prefer to minimize ui clicks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将文本放入
中怎么样?
HTML
jQuery
在这里试试:http://jsfiddle.net/6uXx8/
What about putting your text in a
<span>
?HTML
jQuery
Try it here: http://jsfiddle.net/6uXx8/
尝试添加句柄。这个想法是,您只能从手柄开始拖动项目,例如,该项目可以是元素内的图标。
Try adding a handle. The idea is that you can only start dragging the item from the handle, which could be, for example, an icon inside the element.