(Created page with "<html> <script> →From: https://github.com/luster-io/prevent-overscroll/blob/master/index.html Purpose: Disable elastic scrolling effect in mobile Safari: var overscroll...") |
|||
Line 37: | Line 37: | ||
} | } | ||
}) | }) | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script> | ||
+ | $(function() | ||
+ | { | ||
+ | $(".hamburger").click(function() | ||
+ | { | ||
+ | $(".navigation").toggleClass("open"); | ||
+ | }); | ||
+ | |||
+ | $(".m-dropdown a").click(function(event) | ||
+ | { | ||
+ | var target = $(event.target); | ||
+ | if(!target.siblings().hasClass('show')) | ||
+ | { | ||
+ | $(".m-dropdown-content").removeClass('show'); | ||
+ | target.siblings().addClass('show'); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | $(".m-dropdown-content").removeClass('show'); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | //Navbar Behavior | ||
+ | var prevScrollpos = window.pageYOffset; | ||
+ | window.onscroll = function() { | ||
+ | var currentScrollPos = window.pageYOffset; | ||
+ | if (prevScrollpos > currentScrollPos) { | ||
+ | document.getElementById("navbar").style.top = "0"; | ||
+ | $(".dropdown").removeClass("nomouse"); | ||
+ | if(!$(".dropdown").is(":visible")) | ||
+ | { | ||
+ | |||
+ | $(".navigation").show(); | ||
+ | } | ||
+ | else { $(".navigation").css("display", "");} | ||
+ | } else { | ||
+ | if($(".navigation").hasClass("open") && !$(".dropdown").is(":visible")){return;} | ||
+ | document.getElementById("navbar").style.top = "-60px"; | ||
+ | $(".dropdown").addClass("nomouse"); | ||
+ | $(".navigation").hide(); | ||
+ | |||
+ | if($(".dropdown").is(":visible")) | ||
+ | { | ||
+ | $(".navigation").css("display", ""); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | prevScrollpos = currentScrollPos; | ||
+ | } | ||
+ | }); | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 05:36, 13 October 2018