Team:UNITN-Trento/JS/Team

From 2013.igem.org

(Difference between revisions)
m
m
Line 30: Line 30:
$(div).addClass( 'tn-hoverTag' );
$(div).addClass( 'tn-hoverTag' );
-
$(div).append( '<span>Click to exit</span><br/>' );
+
$(div).append( '<span>' + $(_self).html() + '</span><br/>' );
$(div).append( '<img src="' + $(_self).attr('href') + '" />' );
$(div).append( '<img src="' + $(_self).attr('href') + '" />' );
 +
$(div).append( '<span>Click to exit</span><br/>' );
$(div).children().wrapAll( '<div/>' );
$(div).children().wrapAll( '<div/>' );
Line 48: Line 49:
$(div).addClass( 'tn-hoverTag' );
$(div).addClass( 'tn-hoverTag' );
-
$(div).append( '<span>Click to exit</span><br/>' );
+
$(div).append( '<span>' + $(_self).html() + '</span><br/>' );
$(div).append( '<iframe width="560" height="315" src="' + $(_self).attr('href') + '" frameborder="0" allowfullscreen></iframe>' );
$(div).append( '<iframe width="560" height="315" src="' + $(_self).attr('href') + '" frameborder="0" allowfullscreen></iframe>' );
 +
$(div).append( '<span>Click to exit</span><br/>' );
$(div).children().wrapAll( '<div/>' );
$(div).children().wrapAll( '<div/>' );

Revision as of 08:57, 13 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').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( '' + $(_self).html() + '
' ); $(div).append( '<img src="' + $(_self).attr('href') + '" />' ); $(div).append( 'Click to exit
' ); $(div).children().wrapAll( '<div/>' );

$(div).click(function(e) { e.preventDefault(); $(div).remove(); $('#tn-content .tag').removeClass( 'active' ); }); $('body').append(div); } else { $('#tn-content .tag').removeClass( 'active' ); _self = $(this); _self.addClass( 'active' );

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

$(div).append( '' + $(_self).html() + '
' ); $(div).append( '<iframe width="560" height="315" src="' + $(_self).attr('href') + '" frameborder="0" allowfullscreen></iframe>' ); $(div).append( 'Click to exit
' ); $(div).children().wrapAll( '<div/>' );

$(div).click(function(e) { e.preventDefault(); $(div).remove(); $('#tn-content .tag').removeClass( 'active' ); }); $('body').append(div); } }); }); });