gpt4 book ai didi

javascript - 仅设置一个 div 以在滑动切换时打开

转载 作者:行者123 更新时间:2023-11-28 01:39:12 24 4
gpt4 key购买 nike

我已经设置了 3 篇博文,以便隐藏额外的内容,但是在单击 slideToggle 时,问题是,这发生在具有相同类的每个元素上。

我似乎无法弄清楚如何让它在点击时只有一个滑动。

$(document).ready(function(showmenu) {
$('.post-footer').click(function() {
$('.post-more-content').slideToggle().delay('500');
setTimeout(function(){$('.post-more-content').slideToggle()}, 30000);
});

});

http://jsfiddle.net/0wu05743/

最佳答案

试试这个:

$(document).ready(function (showmenu) {
$('.post-footer').click(function () {
$(this) // clicked element
.parent('article') // move to parent <article>
.find('.post-more-content') // getting more content holder <div>
// of current <article>
.slideToggle();
});
});

Demo

关于javascript - 仅设置一个 div 以在滑动切换时打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26982031/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com