I have a page with a lot of images. I want to hide these images only if they are gifs.
this is the structure:
<div class="wrapper">
<div class="entry">
<div class="image"><img src="imagefile.png" /> </div>
</div>
<div class="entry">
<div class="image"><img src="imagefile.gif" /> </div>
</div>
</div>
I can filter all images this way:
$('.image').closest('.entry').not(".hidewrapper").wrap("<div class='hidewrapper' style=\"display:none\"></div>").closest('.entry').prepend("<a href=\"#\" class=\"unhideImage\" >show me</a>");
Since there are a lot of images on the site: is there a way to filter only .gif files WITHOUT a loop? Or am I just completely wrong that loops need much more performance than single-line ones?
source
share