Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery中children()和Slice()方法的替代方法_Javascript_Jquery - Fatal编程技术网

Javascript jquery中children()和Slice()方法的替代方法

Javascript jquery中children()和Slice()方法的替代方法,javascript,jquery,Javascript,Jquery,我在脚本中使用children()和slice()方法。我需要另一种不使用这种方法的替代方法 这就是我尝试过的: 您可以使用此方法 这将允许您使用classtopnav选择ul中的li,而不是隐藏所有子项,然后显示其中一些,只隐藏您不想要的子项: $('#thumbs').children().filter(function(index) { return (index < newstart || index >= newlimit); }).hide(); 您当前的方

我在脚本中使用children()和slice()方法。我需要另一种不使用这种方法的替代方法

这就是我尝试过的:

您可以使用此方法


这将允许您使用class
topnav
选择
ul
中的
li
,而不是隐藏所有子项,然后显示其中一些,只隐藏您不想要的子项:

$('#thumbs').children().filter(function(index) {
    return (index < newstart || index >= newlimit);
}).hide();

您当前的方法有什么问题?也许这会有所帮助:@xdazz:当我将此脚本嵌入到我的项目中时,出现了一个问题。您可以发送Fiddle演示吗
$('#thumbs').children().filter(function(index) {
    return (index < newstart || index >= newlimit);
}).hide();
$('#thumbs').find(".UiUx3DSSVFlow").filter( /*...*/ ).hide();