Template:Technion/Javascript

$(document).ready(function() { // The function actually applying the offset function offsetAnchor() { if(location.hash.length !== 0) { window.scrollTo(window.scrollX, window.scrollY - 100); } }

// This will capture hash changes while on the page $(window).on("hashchange", function () { offsetAnchor(); });

// This is here so that when you enter the page with a hash, // it can provide the offset in that case too. Having a timeout // seems necessary to allow the browser to jump to the anchor first. window.setTimeout(function() { offsetAnchor(); }, 1); // The delay of 1 is arbitrary and may not always work right (although it did in my testing).

if (window.scrollY >= 350) { $('.up_button').fadeIn(); } else { $('.up_button').fadeOut(); }


$(window).scroll(function () {

         if ($(this).scrollTop() > 350) {
             $('.up_button').fadeIn();
         } else {
             $('.up_button').fadeOut();
         }
     });
     $('.up_button').click(function () {
         $("html, body").animate({
             scrollTop: 0
         }, 600);
         return false;
     });



/***********************************old-dropdown-menu-code---not-relevant************************************* var scroll_flag; var hover_flag = false;

if (window.scrollY >= 450) { scroll_flag = 1; } else { scroll_flag = 0; }

if (scroll_flag == 1) { $(".dropdown nav").css("max-height", "0px"); } else { $(".dropdown nav").css("max-height", "999px"); }


window.onscroll=function() { if (window.scrollY >= 450) { scroll_flag = 1; } else { scroll_flag = 0; } if ((hover_flag == false) && (scroll_flag == 1)) { $(".dropdown nav").css("max-height", "0px"); } else { $(".dropdown nav").css("max-height", "999px"); } }

$(".dropdown").hover(function() { hover_flag = true; $(".dropdown nav").css("max-height", "999px"); },

function() { hover_flag = false; if(scroll_flag == 1) { $(".dropdown nav").css("max-height", "0px"); } });

                                                                      • old-dropdown-menu-code---not-relevant---end*****************************/



});