Difference between revisions of "Template:Technion/Javascript"
Line 1: | Line 1: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
+ | $(window).on("hashchange", function () { | ||
+ | window.scrollTo(window.scrollX, window.scrollY - 100); | ||
+ | }); | ||
var scroll_flag; | var scroll_flag; | ||
var hover_flag = false; | var hover_flag = false; |
Revision as of 13:59, 9 September 2015
$(document).ready(function() {
$(window).on("hashchange", function () {
window.scrollTo(window.scrollX, window.scrollY - 100);
}); 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"); } });
});