Image Thumbnail Viewer II
http://www.dynamicdrive.com/dynamici...thumbnail2.htm
I've got the ITV2 working fine. But, I need to make it so that the "big" image does a rollover for "before" and "after" photos, and make it so that I can actually do a "caption" in a div that has an appropriate id of "caption."
If possible, I'd like to make the caption change on rollover as well (i.e "This is the photo (before)" and "This is the photo (after)")
I know just enough javascript to get myself into trouble, and nowhere near enough about jQuery.
I know I could change the caption with the innerHTML property. But I am completely lost when it comes to jQuery. I can barely follow the logic of the ITV2, let alone be able to extend it to do things I need to be able to do.
Can someone help me out here?
EDIT:
The "live" (well, I'm still working on things) page I am using this in is located at: http://www.cmwagner.net/temporary/Hu...ileGallery.php
I tried adding the following to the document.ready function (this is the entire document.ready() function), based on reading http://www.shopdev.co.uk/blog/jquery...rs-using-this/, plus some info from http://webdevel.blogspot.com/2008/04...th-jquery.html but it doesn't work.
Code:jQuery(document).ready(function($){ var $anchors=$('a[rel="enlargeimage"]') //look for links with rel="enlargeimage" $anchors.each(function(i){ var options={} var rawopts=this.getAttribute('rev').split(',') //transform rev="x:value1,y:value2,etc" into a real object for (var i=0; i<rawopts.length; i++){ var namevalpair=rawopts[i].split(/:(?!\/\/)/) //avoid spitting ":" inside "http://blabla" options[jQuery.trim(namevalpair[0])]=jQuery.trim(namevalpair[1]) } $(this).addthumbnailviewer2(options) }) // preload images first (can run before page is fully loaded) $.preloadImages( "images/gallery/img1_b.jpg", "images/gallery/img2_b.jpg", "images/gallery/img3_b.jpg", "images/gallery/img4_b.jpg", "images/gallery/img5_b.jpg", "images/gallery/img6_b.jpg", "images/gallery/img7_b.jpg", "images/gallery/img8_b.jpg", "images/gallery/img9_b.jpg", "images/gallery/img10_b.jpg", "images/gallery/img11_b.jpg", "images/gallery/img12_b.jpg"); $(function() { $("#mainImg").hover(function() { $(this).attr("src", $(this).attr("src").split("_a.").join("_b.")); }, function() { $(this).attr("src", $(this).attr("src").split("_b.").join("_a.")); }); }); })



Reply With Quote

Bookmarks