Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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 嵌套在每个()中的函数,该函数应用于所有元素而不是单个元素_Javascript_Jquery_Html - Fatal编程技术网

Javascript 嵌套在每个()中的函数,该函数应用于所有元素而不是单个元素

Javascript 嵌套在每个()中的函数,该函数应用于所有元素而不是单个元素,javascript,jquery,html,Javascript,Jquery,Html,我有一个jquery脚本,用于对一系列类应用分页。除了我有一个嵌套函数showPage,它应该只应用于当前类,但是在所有类中使用元素,并将操作应用于最后一个项之外,其他大部分工作都正常 已经尝试切换到for循环,而不是each循环,但是提供了类似的功能,但存在相同的问题 $document.readyfunction{ var list=document.getElementsByClassName'content_display'; 列表大小=5; var fourWide=window.m

我有一个jquery脚本,用于对一系列类应用分页。除了我有一个嵌套函数showPage,它应该只应用于当前类,但是在所有类中使用元素,并将操作应用于最后一个项之外,其他大部分工作都正常

已经尝试切换到for循环,而不是each循环,但是提供了类似的功能,但存在相同的问题

$document.readyfunction{ var list=document.getElementsByClassName'content_display'; 列表大小=5; var fourWide=window.matchMediamax-width:800px; var threeWide=window.matchMediamax-width:600px 如果fourWide.matches{ //屏幕小于800px 列表大小=4; } 如果fourWide.matches{ //屏幕小于600px listSize=3; } $lists.eachfunction{ var contentCount=$this.find'ul li.length var pageCount=contentCount/listSize; 如果contentCount=listSize*page-1&&n $document.readyfunction{ var list=document.getElementsByClassName'content_display'; var-listSize=5; var fourWide=window.matchMediamax-width:800px; var threeWide=window.matchMediamax-width:600px 如果fourWide.matches{ //屏幕小于800px 列表大小=4; } 如果fourWide.matches{ //屏幕小于600px listSize=3; } $lists.eachfunction{ var contentCount=$this.find'ul li.length var pageCount=contentCount/listSize; 如果contentCount=listSize*page-1&&n你的问题不清楚!为什么以及在哪里尝试添加或删除该类?是否可以编辑问题以获得关联代码?请检查showPage变量,它作为全局引用,在连续循环中被覆盖