jquery可拖动隐藏内容(jquery draggable with hidden content)

编程入门 行业动态 更新时间:2024-10-25 02:20:28
jquery可拖动隐藏内容(jquery draggable with hidden content)

我正在使用可拖动和可排序的列表来拖动和排序它们之间的项目。 但是,我拥有的物品是可滑动的(即点击它们的dhows / hides内容)。 当我将项目从一个列表拖动到另一个列表时,滑动效果会丢失。 此外,如果我有一个隐藏其子节点的项目,并将项目拖动到另一个列表,则只拖动该项目(没有任何子项内容)。 这是代码

http://jsbin.com/ujivav/1/edit

I am using draggable and sortable lists to have items dragged and sorted between them. However, the items I have are slidable (i.e. clicking on them dhows/hides content). When I drag an item from one list to another, the sliding effect is lost. Also, if I have a item with its children nodes hidden, and I drag the item to another list, only the item (without any children content) is dragged. Here is the code

http://jsbin.com/ujivav/1/edit

最满意答案

KHY是正确的,但您也可以更改要使用的click事件,如下所示:

$('body').on('click', '.clicktohide',function(){ $(this).siblings().slideToggle('fast'); });

这是一个例子http://jsbin.com/ujivav/4/edit

KHY is correct, but you could also change the click event to use on instead, like so:

$('body').on('click', '.clicktohide',function(){ $(this).siblings().slideToggle('fast'); });

Here's an example http://jsbin.com/ujivav/4/edit

更多推荐

本文发布于:2023-07-24 01:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240094.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:拖动   内容   jquery   content   hidden

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!