Team:UNITN-Trento/JS/Team

From 2013.igem.org

(Difference between revisions)
Line 17: Line 17:
$( '#jms-slideshow' ).jmslideshow();
$( '#jms-slideshow' ).jmslideshow();
-
$('#jms-slideshow .image img').each(function() { $(this).mouseenter(swapBg(this)); });
+
$('#jms-slideshow .image img').each(function() {
-
$('#jms-slideshow .image img').each(function() { $(this).mouseleave(swapBg(this)); });
+
$(this).mouseenter(function(e) {
 +
e.preventDefault();
 +
swapBg(this);
 +
});
 +
});
 +
$('#jms-slideshow .image img').each(function() {
 +
$(this).mouseleave(function(e) {
 +
e.preventDefault();
 +
swapBg(this);
 +
});
 +
});
});
});

Revision as of 12:35, 12 August 2013

function swapBg(img) { alert(1); alt = $(img).attr('data-alt'); src = $(img).attr('src'); alert(2); $(img).fadeOut('fast', function() { alert(3); $(img).attr('src',alt); $(img).attr('data-alt',src); $(img).fadeIn(); alert(4); }); alert(5); }

$(document).ready(function() { $( '#jms-slideshow' ).jmslideshow();

$('#jms-slideshow .image img').each(function() { $(this).mouseenter(function(e) { e.preventDefault(); swapBg(this); }); }); $('#jms-slideshow .image img').each(function() { $(this).mouseleave(function(e) { e.preventDefault(); swapBg(this); }); }); });