From 6029538170b9612bc8fc74cd3a11981660f38f69 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 3 Aug 2016 15:33:37 -0400 Subject: [PATCH] added sticky header via javascript since foundation sticky class doesn't appear to be working --- js/app.js | 15 +++++++++++++++ js/custom/pageSetup.js | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/js/app.js b/js/app.js index 2d7e1d0..4e4b110 100644 --- a/js/app.js +++ b/js/app.js @@ -50,4 +50,19 @@ $(document).ready(function () { this.title = $(this.element).find('img').attr('alt'); } }); + var body = $("body"); + var sticky = $(".sticky"); + $(window).on("scroll", function () { + var scrollTop = $(window).scrollTop(); + if(scrollTop > 0){ + $(sticky).addClass("fixed"); + $(body).addClass("f-topbar-fixed"); + } +// if(scrollTop == 0){ +// $(sticky).removeClass("fixed"); +// $(body).removeClass("f-topbar-fixed"); +// } + console.log(scrollTop); + }); + }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 2c77d7d..690bd36 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -41,4 +41,19 @@ $(document).ready(function () { this.title = $(this.element).find('img').attr('alt'); } }); + var body = $("body"); + var sticky = $(".sticky"); + $(window).on("scroll", function () { + var scrollTop = $(window).scrollTop(); + if(scrollTop > 0){ + $(sticky).addClass("fixed"); + $(body).addClass("f-topbar-fixed"); + } +// if(scrollTop == 0){ +// $(sticky).removeClass("fixed"); +// $(body).removeClass("f-topbar-fixed"); +// } + console.log(scrollTop); + }); + }); -- 2.17.1