|
|
Line 40: |
Line 40: |
| | | |
| | | |
− | <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>
| |
| </html> | | </html> |