/* * AlienScience JS */ jQuery(document).ready(function() { /* Homepage slider */ jQuery('#slider').bxSlider({ pager: true, captions: true }); /* Header icon animation */ jQuery(".header-button").hover(function(){ jQuery(this).find(".button-icon").animate({ width: "64px", height: "64px", marginTop: "-=40px" }, 300); jQuery(this).find(".button-fa").animate({ width: "64px", height: "64px", fontSize: "64px", marginTop: "-=40px" }, 300); jQuery(this).find(".button-text").animate({ opacity: "0", marginTop: "+=16px" }, 300); }, function() { jQuery(this).find(".button-icon").animate({ width: "32px", height: "32px", marginTop: "+=40px" }, 120); jQuery(this).find(".button-fa").animate({ width: "32px", height: "32px", fontSize: "32px", marginTop: "+=40px" }, 120); jQuery(this).find(".button-text").animate({ opacity: "1", marginTop: "-=16px" }, 120); }); /* Bullet point animation (requires background animation plugin) */ jQuery(".widget ul li a").hover(function(){ jQuery(this).animate({ backgroundPosition: "(7px 7px)" }, 80); }, function() { jQuery(this).animate({ backgroundPosition: "(-5px 7px)" }, 240); }); /* Sidebar scrolling */ var $sidebar = jQuery("#secondary"), $window = jQuery(window), /*$height = $sidebar.css("height"), $area = $sidebar.parent().css("height"),*/ $height = parseInt(jQuery("#footer").css("height")) + parseInt(jQuery(".footer-widgets").css("height")), $area = parseInt(jQuery(document).height()), offset = $sidebar.offset(), topPadding = 20; $window.scroll(function() { /*console.log($window.scrollTop() + " > " + $area + " - " + $height);*/ if($window.scrollTop() > ($area - $height - 160 - parseInt($sidebar.css("height")))) { $sidebar.css("position", "relative"); $sidebar.css("left", 0); $sidebar.css("top", ($area - $height - 140 - parseInt($sidebar.css("height")) - offset.top)); // - parseInt($window.height()) /*console.log($window.scrollTop() + " > " + $area + " - " + $height + " - " + parseInt($window.height()) + " - " + parseInt($sidebar.css("height")));*/ } else if(($window.scrollTop() + topPadding) > offset.top) { $sidebar.css("position", "fixed"); $sidebar.css("left", offset.left); $sidebar.css("top", topPadding); } else { $sidebar.css("position", "relative"); $sidebar.css("left", 0); $sidebar.css("top", 0); } }); /* Flash hacks */ var src; jQuery("iframe").each(function(){ src = jQuery(this).attr("src"); jQuery(this).attr("src", src+"?wmode=opaque"); }); /* Plugin hacks */ jQuery(".remove_button").attr("value", "Remove"); });