Team:UNITN-Trento/JS/Team

From 2013.igem.org

Revision as of 07:50, 13 August 2013 by Ggirelli (Talk | contribs)

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').each(function() { $(this).click(function(e) { e.preventDefault(); swapBg($(this).children('img')); }); });

$('#tn-content .tag').each(function() { $(this).click(function(e) { e.preventDefault(); if ( $(this).attr( 'data-type' ) === "img" && !$(this).hasClass( 'active' ) ) { $('#tn-content .tag').removeClass( 'active' ); _self = $(this); _self.addClass( 'active' );

div = $('<div/>'); $(div).addClass( 'tn-hoverTag' );

$(div).append( 'Click to exit' ); $(div).append( '<img src="' + $(_self).attr('href') + '" />' );

$(div).click(function(e) { e.preventDefault(); $(div).remove(); }); $('body').append(div); } else { alert("E"); } }); }); });