From aa70e245caa814adb95614e0893cc5bbac8fbc3e Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 17 Feb 2016 16:10:56 -0500 Subject: [PATCH] fixing scroll issue with anchor tags and sticky header --- js/app.js | 33 ++++++++++++++++++++++++++++++--- js/custom/pageSetup.js | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/js/app.js b/js/app.js index 1582362..793dc75 100644 --- 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); + }); + }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 0104f7e..20d23ab 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -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); + }); + }); -- 2.17.1