jquery - Hover over link, image appears loop -
i'm building site gallery. have table of exhibitions in simple list format, , i'm after when user hovers on title of exhibition, preview image appears, , when hover off disappears.
i'm using wordpress , have core structure in place:
i have table have 1 single image displayed, absolutely , set display none have added unique post classes both title of exhibition , image
i can't seem link both up.
this jquery far thought work:
$('table#archive-table td a').hover( var classname = $(this).attr('class'); function () { $('body.archive .first-show-image.'classname).fadein('slow'); }, function () { $('body.archive .first-show-image.'classname).fadeout('slow'); } );
example html:
<a class="33" href="#">palomar</a> <div class="first-show-image 33"> <div class="grid_2"> <img src="test.png" /> </div> </div> <a class="48" href="#">palomar #2</a> <div class="first-show-image 48"> <div class="grid_2"> <img src="test.png" /> </div> </div>
cheers, r
i don't know how closely example code matches real code, there's error in javascript. try this
$('table#archive-table td a').hover( function () { $('body.archive .first-show-image.' + $(this).attr('class')).fadein('slow'); }, function () { $('body.archive .first-show-image.' + $(this).attr('class')).fadeout('slow'); } );
Comments
Post a Comment