From: Anthony Talarico Date: Wed, 3 Aug 2016 19:33:37 +0000 (-0400) Subject: added sticky header via javascript since foundation sticky class doesn't appear to... X-Git-Tag: v1.0.0^2~32 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=6029538170b9612bc8fc74cd3a11981660f38f69;p=WP-Themes%2Fpetoskey.git added sticky header via javascript since foundation sticky class doesn't appear to be working --- 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); + }); + });