我想仅当用户单击标签按钮时才在 Tumblr 博客上显示标签列表。为此,我使用 HTML 和 jQuery。
HTML
<span class="tags-link">Tags</span>
<ul class="tags">
<li> <a href="{TagURL}">{Tag}</a> </li>
</ul>
jQuery
$(document).ready(function(){
$(".tags-link").click(function() {
$(".tags").slideDown(700, function(){
//end animation
});
});
});
每次我点击 .tags-link
时,每个 .tags
都会显示在页面上,而我只想要用户点击的帖子中的标签待展示。我最近开始学习 jQuery,但我有点迷失了......
最佳答案
您可以使用.next()
http://api.jquery.com/next/
$(this).next(".tags").slideDown(700, function(){
关于javascript - 将 jQuery .click() 函数与单个元素一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26320767/