Reputation: 19939
I asked this question earlier today jQuery - showing first three images of a gallery; hiding the remainder but when testing out other pieces and reseeding, I realized that the sol'n only worked for the first image-container-box
. Unfortunately, I'll be having multiple image-container-box
's per page. Is there a way to tell jquery each of the image-container-box rather than just the first? Or, did I misunderstand the accepted answer?
thx
Upvotes: 0
Views: 106
Reputation: 39872
You will have make use of jQuery's each to apply the slicing code to each one.
$('.image-container-box').each( function() {
$(this).children('.image-box').slice(2).hide(); //or use find if image-box isn't a direct descendent of image-container-box
});
Upvotes: 1