Page was scrolling 30px more on submenu clicks than main nav clicks
authorLaury GvR <laury@gaslightmedia.com>
Tue, 15 Aug 2017 12:53:20 +0000 (08:53 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 15 Aug 2017 12:53:20 +0000 (08:53 -0400)
assets/js/global.js
assets/js/navigation.js

index a7b54d1..5b2d40a 100755 (executable)
                 var scrollTarget = $($(this).attr("href"));
     //            console.log(scrollTarget);
                 if (scrollTarget) {
-                    $('body, html').animate({
-                        scrollTop: scrollTarget.offset().top-90
-                    }, 300);
+                    if ($(window).width() > 1280) {
+                        $('body, html').animate({
+                            scrollTop: scrollTarget.offset().top-90
+                        }, 300);
+                    } else {
+                        $('body, html').animate({
+                            scrollTop: scrollTarget.offset().top-120
+                        }, 300);
+                    }
                 }
                 target = $(this).attr('id').split("-")[1];
                 parent_target = $(this).parents('.parent-container').attr('id').split("-")[1];
index c85f414..e8c7bcb 100755 (executable)
         $(".static-nav-link").click(function(e) {
             e.preventDefault();
             var scrollTarget = $($(this).attr("href"));
-//            console.log(scrollTarget);
             if (scrollTarget) {
-                $('body, html').animate({
-                    scrollTop: scrollTarget.offset().top-120
-                }, 300);
+                if ($(window).width() > 1280) {
+                    $('body, html').animate({
+                        scrollTop: scrollTarget.offset().top-90
+                    }, 300);
+                } else {
+                    $('body, html').animate({
+                        scrollTop: scrollTarget.offset().top-120
+                    }, 300);
+                }
             }
         });
 
         $(".static-home-link").click(function(e) {
             e.preventDefault();
             var scrollTarget = $('.home');
-//            console.log(scrollTarget);
             if (scrollTarget) {
-                $('body, html').animate({
-                    scrollTop: scrollTarget.offset().top-120
-                }, 300);
+                if ($(window).width() > 1280) {
+                    $('body, html').animate({
+                        scrollTop: scrollTarget.offset().top-90
+                    }, 300);
+                } else {
+                    $('body, html').animate({
+                        scrollTop: scrollTarget.offset().top-120
+                    }, 300);
+                }
             }
 
         });
 
         function setActiveNavItem() {
-            console.log("here");
             $(".nav-parent").each(function() {
                 if  ( $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').not(".active") ) {
                     if(myTopPosition > $(this).offset().top && ( $(this).offset().top + $(this).next().outerHeight() > myTopPosition-90) ) {
-
                         $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').addClass("active");
                     } else {
-                        //console.log("no");
                         $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').removeClass("active");
                     }
                 }