Team:SYSU-China/common.js

From 2013.igem.org

/*Navigater start*/

$(document).ready(function(){$("div.navigater").html('')});

/*Navigater End*/

/* Reference Anchor Start */

$(document).ready(function(){ anchor_quote = $(".quote"); anchor_name = 0; anchor_quote.each(function() { var refer_num = $(this).text(); anchor_name += 1; $(this).attr({"href":"#R"+anchor_name, "name":"Q"+anchor_name}); $(".references:contains("+refer_num+")").each(function(){ $(this).attr({"href":"#Q"+anchor_name, "name":"R"+anchor_name}) }); }); });

/* Reference Anchor End */

/* Figure function Start */

$(function(){

               $("div#bodyContent").css({"background-image":"url(Logo-2013-SYSU-CHINA.png) 90% 1%;"});

$(".fig_img").click(function(){ var _this = $(this); imgShow("#outerdiv", "#innerdiv", "#bigimg", _this); }); });

function imgShow(outerdiv, innerdiv, bigimg, _this){ var src = _this.attr("src");//get the src from fig_img $(bigimg).attr("src", src);//value to #bigimg

/*get the full size & show in the new layer*/ $("<img/>").attr("src", src).load(function(){ var windowW = $(window).width(); var windowH = $(window).height(); var realWidth = this.width; var realHeight = this.height; var imgWidth, imgHeight; var scale = 0.8;//zoom it if the img size larger than the window's

if(realHeight>windowH*scale) { imgHeight = windowH*scale; imgWidth = imgHeight/realHeight*realWidth; if(imgWidth>windowW*scale) { imgWidth = windowW*scale; } } else if(realWidth>windowW*scale) { imgWidth = windowW*scale;

                       imgHeight = imgWidth/realWidth*realHeight;

} else { imgWidth = realWidth; imgHeight = realHeight; }

               $(bigimg).css("width",imgWidth);

var w = (windowW-imgWidth)/2; var h = (windowH-imgHeight)/2; $(innerdiv).css({"top":h, "left":w}); $(outerdiv).fadeIn("fast");//fade in speed for #outerdiv & fig_img });

$(outerdiv).click(function(){ $(this).fadeOut("fast"); }); }

/* Figure function End */ /* results guide start */ $(document).ready(function(){ $("a.guide_button , a.guide_button2").mouseover(function(){ $(this).animate({left:'+=15px'},10); $(this).animate({left:'-=15px'},10); $(this).animate({top:'+=15px'},10); $(this).animate({top:'-=15px'},10); }); }); /* results guide end */