如何选择div的每个子节点并获得第n个数字

God*_*dje 0 html javascript css jquery pug

所以我真的很愚蠢.我正在为官方游戏网站制作设计.他告诉我会有很多截图.我做了一个设计,一切都很酷,但实际上有很多,所以我想通过jQuery在Mobile版本(px <640px)中关闭它们,然后创建按钮以显示它们.我知道互联网上有很多指令,但它们根本没有与我的标记进行比较,实际上我希望它与我想的完全相同.所以我想要的是找到我的图像块的每个子项的第n个子编号,以及每个第n个子编号超过4到.hide()的块.谢谢你的帮助!

      <div class="images-block">
        <div class="image-sq">
          <p>? Expand</p>
        </div><div class="image-sq">
          <p>? Expand</p>
        </div><div class="image-sq">
          <p>? Expand</p>
        </div><div class="image-sq"> 
          <p>? Expand</p>
        </div><div class="image-sq"> 
          <p>? Expand</p>
        </div><div class="image-sq">
          <p>? Expand </p>
        </div>
      </div>
Run Code Online (Sandbox Code Playgroud)

Ric*_*ton 5

使用gt选择器.

$(".images-block .image-sq:gt(3)").hide();
Run Code Online (Sandbox Code Playgroud)

https://api.jquery.com/gt-selector/

选择匹配集中索引大于索引的所有元素.