From 6c859550259f725c59b8e9c169cb1c4a2a968587 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 3 Aug 2016 16:31:53 -0400 Subject: [PATCH] added width variable to help check for window width to apply margin to the top of ad rotate after header has a class of fixed --- js/app.js | 7 +++++-- js/custom/pageSetup.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index 8af87d5..aea09eb 100644 --- a/js/app.js +++ b/js/app.js @@ -50,16 +50,19 @@ $(document).ready(function () { this.title = $(this.element).find('img').attr('alt'); } }); + var slideshow = $("#slideshow"); var body = $("body"); var sticky = $(".sticky"); + var width = $(window).width(); + $(window).on("scroll", function () { var scrollTop = $(window).scrollTop(); if(scrollTop > 0){ $(sticky).addClass("fixed"); - if(scrollTop > 319 && scrollTop < 641 ){ + if(width > 319 && width < 641 ){ $(slideshow).css("margin-top", "140px"); - } else if(scrollTop > 639 && scrollTop < 1025){ + } else if(width > 639 && width < 1025){ // $(slideshow).css("margin-top", "140px"); } } diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 69f4ffe..df41742 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -41,16 +41,19 @@ $(document).ready(function () { this.title = $(this.element).find('img').attr('alt'); } }); + var slideshow = $("#slideshow"); var body = $("body"); var sticky = $(".sticky"); + var width = $(window).width(); + $(window).on("scroll", function () { var scrollTop = $(window).scrollTop(); if(scrollTop > 0){ $(sticky).addClass("fixed"); - if(scrollTop > 319 && scrollTop < 641 ){ + if(width > 319 && width < 641 ){ $(slideshow).css("margin-top", "140px"); - } else if(scrollTop > 639 && scrollTop < 1025){ + } else if(width > 639 && width < 1025){ // $(slideshow).css("margin-top", "140px"); } } -- 2.17.1