Team:UNITN-Trento/JS/Team
From 2013.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | function swapBg( | + | function swapBg(img) { |
- | alt = | + | alt = img.attr('data-alt'); |
- | src = | + | src = img.attr('src'); |
- | + | img.fadeOut('fast', function() { | |
- | + | img.attr('src',alt); | |
- | + | img.attr('data-alt',src); | |
- | + | img.fadeIn(); | |
}); | }); | ||
} | } |
Revision as of 12:30, 12 August 2013
function swapBg(img) { alt = img.attr('data-alt'); src = img.attr('src'); img.fadeOut('fast', function() { img.attr('src',alt); img.attr('data-alt',src); img.fadeIn(); }); }
$(document).ready(function() { $( '#jms-slideshow' ).jmslideshow();
$('#jms-slideshow .image img').mouseenter(swapBg(this)); $('#jms-slideshow .image img').mouseleave(swapBg(this)); });