你好,我为一些 div 中的一些元素做了一个假加载。我的问题是当我点击 加载更多 jquery 切片并加载点击我的所有元素(来 self 的第一个容器和第二个容器)。
这是我的代码和here is jsFiddle :
$(".tohide").hide();
$(".tohide").slice(0, 3).show();
$(".more-comments").click(function(){
var showing = $(".tohide:visible").length;
$(".tohide").slice(showing - 1, showing + 999).show();
});
最佳答案
使用 next()
和 children()
,像这样:
$(this).next("#comments").children(".tohide").slice(showing, showing + 999).show();
参见 DEMO .
关于javascript - jQuery 父切片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14781392/