0

Ive looked all over for an answer to this question...

I am using the Galleriffic plugin on my website to display a gallery of images and i want to be able to change the images by just dropping them in a folder.

My problem is that if there is no image file to be displayed then a default missing photo image is there. I think it looks untidy/unprofessional.

So is there a way to hide the image if the file is unavailable?

I have tried this:

$("img").error(function () { 
$(this).hide();
});

That got rid of the missing photo image but the class"thumb" container was still visible.

I then tried:

$("img").error(function () { 
$("thumb").hide();

});

But that removed all the thumbnails if one image was missing.

Let me know if this makes sense, if not ill try explain it better.

The page I'm working on is here: http://grahamsmotorcycles.co.uk/beta/stock/bike2.html

Thanks in advance for any help.

Stephen

Stephen
  • 7
  • 1
  • why would there be a missing image in the first place? There are numerous ways to manage images without sending invalid ones to a page This sounds like an [X-Y problem](http://xyproblem.info/) – charlietfl Jan 06 '15 at 21:47
  • Thanks for your comment, I want to be able to change the images on the page by simply replacing the source images (so i can replace the stock on my site every time something sells and not every item has the same amount of images) I want to use galleriffic but as far as Im aware you have to individually link each image? please let me know if I'm barking up the wrong tree – Stephen Jan 06 '15 at 21:57

1 Answers1

0

Why dont you use $(this).parents('.thumb').remove() instead of $(this).hide()

Ahmadbaba46
  • 221
  • 2
  • 7