fixing scroll issue with anchor tags and sticky header
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 17 Feb 2016 21:10:56 +0000 (16:10 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 17 Feb 2016 21:10:56 +0000 (16:10 -0500)
js/app.js
js/custom/pageSetup.js

index 1582362..793dc75 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -347,10 +347,8 @@ $(document).ready(function () {
         y = currentDate.getFullYear();
         
         // this variable is for passing to booking site
-        
         requiredDate = y + '-' + m + '-' + d;
         minDays = y + '-' + m + '-' + dd;
-        
         $("#departOff").attr("min", minDays);
         if (requiredDate <= $("#arriveOff").attr("min")) {
             minDays = $("#arriveOff").attr("min");
@@ -388,12 +386,41 @@ $(document).ready(function () {
     var $topMenu = $("ul#menu-top-menu > li");
     var $topMenuLink = $("ul#menu-top-menu li > a");
     var $dropDown = $("ul#menu-top-menu li").find(".dropdown");
-    $("#headerLinks").children("ul#menu-top-menu").children("li").each(function () { 
+    $("#headerLinks").children("ul#menu-top-menu").children("li").each(function () {
         $($topMenuLink).css("font-size", "16px");
         $($topMenuLink).css("padding", "10px 5px");
     });
     $($topMenu).each(function () {
        $(this).removeClass("active") ;
     });
+    
     $("#menu-top-menu-1").children("li:nth-child(2)").children("a:nth-child(1)").addClass("offCanvasLinks");
+    
+
+    $("a:contains('Exploring')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#exploring").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Golf')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#golf").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Hiking')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#hiking").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('On The Water')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#water").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Birding')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#birding").offset().top - 165
+    }, 1000);
+    });
+
 });
index 0104f7e..20d23ab 100644 (file)
@@ -146,10 +146,8 @@ $(document).ready(function () {
         y = currentDate.getFullYear();
         
         // this variable is for passing to booking site
-        
         requiredDate = y + '-' + m + '-' + d;
         minDays = y + '-' + m + '-' + dd;
-        
         $("#departOff").attr("min", minDays);
         if (requiredDate <= $("#arriveOff").attr("min")) {
             minDays = $("#arriveOff").attr("min");
@@ -187,12 +185,41 @@ $(document).ready(function () {
     var $topMenu = $("ul#menu-top-menu > li");
     var $topMenuLink = $("ul#menu-top-menu li > a");
     var $dropDown = $("ul#menu-top-menu li").find(".dropdown");
-    $("#headerLinks").children("ul#menu-top-menu").children("li").each(function () { 
+    $("#headerLinks").children("ul#menu-top-menu").children("li").each(function () {
         $($topMenuLink).css("font-size", "16px");
         $($topMenuLink).css("padding", "10px 5px");
     });
     $($topMenu).each(function () {
        $(this).removeClass("active") ;
     });
+    
     $("#menu-top-menu-1").children("li:nth-child(2)").children("a:nth-child(1)").addClass("offCanvasLinks");
+    
+
+    $("a:contains('Exploring')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#exploring").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Golf')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#golf").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Hiking')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#hiking").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('On The Water')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#water").offset().top - 165
+    }, 1000);
+    });
+     $("a:contains('Birding')").on("click", function () {
+           $('html, body').animate({
+        scrollTop: $("#birding").offset().top - 165
+    }, 1000);
+    });
+
 });