Line 35: | Line 35: | ||
window.onscroll = function() { | window.onscroll = function() { | ||
var currentScrollPos = window.pageYOffset; | var currentScrollPos = window.pageYOffset; | ||
+ | //If At (or above @safari) the top | ||
+ | if(currentScrollPos <= 0 ) { | ||
+ | |||
+ | document.getElementById("navbar").style.top = "10px"; | ||
+ | $(".dropdown").removeClass("nomouse"); | ||
+ | if(!$(".dropdown").is(":visible")) | ||
+ | { | ||
+ | |||
+ | $(".navigation").show(); | ||
+ | } | ||
+ | else { $(".navigation").css("display", "");} | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | //If Scrolling Up | ||
if (prevScrollpos > currentScrollPos) { | if (prevScrollpos > currentScrollPos) { | ||
document.getElementById("navbar").style.top = "10px"; | document.getElementById("navbar").style.top = "10px"; | ||
Line 44: | Line 59: | ||
} | } | ||
else { $(".navigation").css("display", "");} | else { $(".navigation").css("display", "");} | ||
− | } else { | + | } |
+ | //If Scrolling Down | ||
+ | else { | ||
if($(".navigation").hasClass("open"))if(!$(".dropdown").is(":visible")){return;} | if($(".navigation").hasClass("open"))if(!$(".dropdown").is(":visible")){return;} | ||
document.getElementById("navbar").style.top = "-45px"; | document.getElementById("navbar").style.top = "-45px"; | ||
Line 60: | Line 77: | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</script> | </script> | ||
Revision as of 18:47, 17 October 2018