Template:WUR script.js
From 2012.igem.org
var jQueryUrl = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; //var cssUrl = "http://www.the-falcons.nl/igem2/style.css"; var cssUrl = "https://2012.igem.org/Template:WUR_style.css?action=raw&ctype=text/css"; var nivoJsUrl = 'https://2012.igem.org/Template:WUR_nivo.js?action=raw&ctype=text/javascript'; var nivoCssUrl = "https://2012.igem.org/Template:WUR_nivo.css?action=raw&ctype=text/css"; var prefixfreeUrl = 'https://2012.igem.org/Template:WUR_prefixfree.js?action=raw&ctype=text/javascript';
var jQueryScriptOutputted = false;
function initJQuery() {
//if the jQuery object isn't available if (typeof(jQuery) == 'undefined') {
if (! jQueryScriptOutputted) { //only output the script once.. jQueryScriptOutputted = true; //output the script (load it from google api) document.write("<script type=\"text/javascript\" src=\"" + jQueryUrl + "\"></script>");
} setTimeout("initJQuery()", 50); } else { $(function() {
jQuery(document).ready(function(){
// CSS $("<link/>", { rel: "stylesheet", type: "text/css", href: cssUrl }).appendTo("head");
// Slider $("<link/>", { rel: "stylesheet", type: "text/css", href: nivoCssUrl }).appendTo("head"); $.getScript(nivoJsUrl, function(){ //http://nivo.dev7studios.com/support/jquery-plugin-usage/ $('#header_slider').nivoSlider({ effect: 'fade', directionNav: false, controlNav: false, pauseTime: 5500, animSpeed: 1000 }); });
// Move menu var menu = $('#navContainer'); $('#navContainer').remove(); $('#content').prepend(menu);
// Move header var header = $('#header_wrapper'); $('#header_wrapper').remove(); $('#content').prepend(header);
// Decorate menu function decorateMenu(el, i) { switch(i) { case 1: el.addClass('ulc1'); i += 1; break;
case 2: el.addClass('ulc2'); i += 1; break;
case 3: i = 1; break;
default: i += 1; } return i; } var i = 0; var ii = 0; menu.find('li').each(function(){ i = decorateMenu($(this),i); ii = $(this).find('ul').find('li').each(function(){decorateMenu($(this),ii);}); });
// Remove title attributes from the menu. // Though this is a bad practice, the design advantage weighted // heavier than the few optically impaired people who visit the // website. menu.find('[title]').removeAttr('title');
// Google Analytics var ga_script = "\ <script type=\"text/javascript\">\ var _gaq = _gaq || [];\ _gaq.push(['_setAccount', 'UA-33423824-1']);\ _gaq.push(['_trackPageview']);\ (function() {\ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\ })();\ </script>"; $('head').append(ga_script);
// Move the Footer $('#contentfooter').appendTo('#content');
$('.bigbutton').hover(function(){ $(this).find('img').animate({ 'margin-top': '-175px' },'fast'); },function(){ $(this).find('img').animate({ 'margin-top': '0px' },'fast'); });
/* // Effect on the home buttons $('.homebutton').hover(function(){ $(this).animate({ height: "300", width: "480", left: "-=90", top: "-=50", 'border-radius': '5px' }, "fast"); },function(){ $(this).animate({ height: "200", width: "320", left: "+=90", top: "+=50", 'border-radius': '0px' }, "fast"); }); */
// If an anchor-link was pressed, make sure the scrolling was done correctly. if(location.hash) { var sId = location.hash.substr(1); var sEl = document.getElementById(sId); var sJQ = $(sEl);
setTimeout(function(){ $(document).scrollTop(sJQ.offset().top); }, 250);
}
// Fix prefixes for CSS3 styles $.getScript(prefixfreeUrl, function(){});
// Animate the project overview $('#poPnas, #poVLPs, #poOutside, #poInside, #poApplications').hide(); $('#poPnas').fadeIn(1000, function(){ $('#poVLPs').fadeIn(1000, function(){ $('#poOutside').fadeIn(1000, function(){ $('#poInside').fadeIn(1000, function(){ $('#poApplications').fadeIn(1000, function(){}); }); }); }); });
}); }); } }
initJQuery();