Team:HUST-China/Animat.js

From 2014.igem.org

    addressUrl = window.location.href;
 if (addressUrl.indexOf("Project") > 0 ) {
         img_left=new Image();
         img_left.src="HUST_WalkLeft.png" ;
         img_right=new Image();
         img_right.src="HUST_WalkRight.png" ;	

} else if (addressUrl.indexOf("Judging") > 0 ){

         img_left=new Image();
         img_left.src="HUST_WalkLeft.png" ;
         img_right=new Image();
         img_right.src="HUST_WalkRight.png" ;	

} else if (addressUrl.indexOf("Safety") > 0 ){

         img_left=new Image();
         img_left.src="HUST_WalkLeft.png" ;
         img_right=new Image();
         img_right.src="HUST_WalkRight.png" ;     

} else if (addressUrl.indexOf("Notebook") > 0 ){

         img_left=new Image();
         img_left.src="HUST_WalkLeft.png" ;
         img_right=new Image();
         img_right.src="HUST_WalkRight.png" ;     

} else if (addressUrl.indexOf("China/Team") > 0 ){

         img_left=new Image();
         img_left.src="HUST_WalkLeft.png" ;
         img_right=new Image();
         img_right.src="HUST_WalkRight.png";     

} else {

       img_left=new Image();
       img_left.src="HUST_WalkLeft.png" ;
       img_right=new Image();
       img_right.src="HUST_WalkRight.png" ;	
    }; 

$(document).ready(function(){ var plength=0; var target=$("li.column"); var img=$("#animat span"); var mid=img.offset().left + img.width()/2 - parseInt(img.css("left"));

	target.mouseenter(function(){

var length=$(this).offset().left + $(this).width()/2 - mid; img.stop(); if(length > plength) { $("#animat span img").attr({"src" : img_right.src}); } else { $("#animat span img").attr({"src" : img_left.src}); } plength=length; img.animate( {left:length}, 500, function(){ $("#animat span img").attr({"src" : "HUST_Front.png"});} );

}); });