Team:SYSU-China/animat.js

From 2013.igem.org

(Difference between revisions)
Scelta (Talk | contribs)
(Created page with "$(document).ready(function(){ var plength=0; var target=$("li.column"); var img=$("#animat span"); var mid=img.offset().left + img.width()/2; target.mouseenter(function(){ ...")
Newer edit →

Revision as of 17:15, 10 September 2013

$(document).ready(function(){ var plength=0; var target=$("li.column"); var img=$("#animat span"); var mid=img.offset().left + img.width()/2; target.mouseenter(function(){ var length=$(this).offset().left + $(this).width()/2 - mid; img.stop(); if(length > plength) { $("#animat span img").attr({"src" : "TeamSYSU-China - 2013_igem_org_files/images/WIKI-MASCOT-RUNNING-RIGHT.GIF"}); } else { $("#animat span img").attr({"src" : "TeamSYSU-China - 2013_igem_org_files/images/WIKI-MASCOT-RUNNING-LEFT.GIF"}); } plength=length; img.animate( {left:length}, 500, function(){ $("#animat span img").attr({"src" : "TeamSYSU-China - 2013_igem_org_files/images/WIKI-MASCOT-STAND.png"});} );

}); var win_width = $(window).width()/2 - $("#address").width()/2; $("#address").css("left",win_width); });