我有以下内容,
$("#slider1next").click(function () {
$(".text:visible").next().show();
});
当显示最后一个类 (.text) 时,我想隐藏 #slider1next 我该如何处理?
最佳答案
向 show()
函数添加回调函数,并评估索引:
$("#slider1next").click(function () {
$(".text:visible").next().show(function() {
if($(this).index() == $('.text').length)
{
$('#slider1next').hide();
}
});
});
请参阅updated jsFiddle .
关于javascript - 显示最后一个类后隐藏按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14774524/