I have a jQuery script that works a little too well.
It wraps all the images on the page with a link to a larger image version which in turn is viewable via the jQuery LightBox script.
Unfortunately not every image on the page is a thumbnail.
Some of course are navigation elements.
The obvious answer is to just add a class like "thumb" to the relevant
images and target them that way HOWEVER I am building the site for
somebody who I am sure knows (and cares) nothing about classes or IDs.
All they know is how to upload images and maybe add an ALT attribute.
So to tackle it a different way I will set up a jQuery script that takes a shotgun approach BUT I want to put a class of "ignore" into the non-thumbnail images.
Hope that makes sense.
Here is the code if that helps.
Code:
<script type="text/javascript">
$(function() {
//wraps each image with a link to the larger version
$("#category img").each(function() {
var Img = $(this).attr('src');
var imgExt = /(\.\w{3,4}$)/;
var newImg = new Image();
newImg.src = Img.replace(imgExt,'_big$1');
var a = $('<a/>').attr('href', newImg.src);
$(a).addClass("lightboxer");
$(this).wrap(a);
});//ends "each" function
//binds the links to the lightbox function
$('a.lightboxer').lightBox();
}); //ends "ready" function
</script>
|