I’m trying to apply this selector to remove all images other than the first in a div that looks like this.
$(".item_cont a img").not(":eq(0)").hide();
as shown here:
http://jsfiddle.net/jojoroxursox/9AFpv/
however when applied to a masonry grid it removes all items, even the ones that only have one image.
http://jsfiddle.net/jojoroxursox/M9Yau/
any suggestions?
In this case you’d want to select all but the first item in the matched element list overall.
.slice(startIndex)is perfect for this set reduction, like so:Here is your updated jsfiddle, though I personally get 403s for all images…so it can’t be seen working clearly.
If I misunderstood and you want to remove all but the first per
.item_cont, what you’ll want is something more on the selector side, like:gt()(greater than index):