From: Anthony Talarico Date: Wed, 3 Aug 2016 20:39:50 +0000 (-0400) Subject: testing custom function that checks the small medium and large view width during... X-Git-Tag: v1.0.0^2~22 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=44efc3ff6164fc44a690431ae288afea51da678f;p=WP-Themes%2Fpetoskey.git testing custom function that checks the small medium and large view width during resizing and scrolling to apply padding to the front page div to push from the sticky header --- diff --git a/js/app.js b/js/app.js index aea09eb..795976f 100644 --- a/js/app.js +++ b/js/app.js @@ -55,16 +55,25 @@ $(document).ready(function () { var body = $("body"); var sticky = $(".sticky"); var width = $(window).width(); + var page_front = $(".page-front"); + function check_window_width(){ + if(width > 319 && width < 641 ){ + $(page_front).css("padding-top", "200px"); + } else if(width > 639 && width < 1025){ + $(page_front).css("padding-top", "155px"); + } else if(width > 1024){ + $(page_front).css("padding-top", "20px"); + } + } + $(window).resize( function () { + check_window_width(); + }); $(window).on("scroll", function () { var scrollTop = $(window).scrollTop(); if(scrollTop > 0){ $(sticky).addClass("fixed"); - if(width > 319 && width < 641 ){ - $(slideshow).css("margin-top", "140px"); - } else if(width > 639 && width < 1025){ -// $(slideshow).css("margin-top", "140px"); - } + check_window_width(); } // if(scrollTop == 0){ diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index df41742..cf725c9 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -46,16 +46,25 @@ $(document).ready(function () { var body = $("body"); var sticky = $(".sticky"); var width = $(window).width(); + var page_front = $(".page-front"); + function check_window_width(){ + if(width > 319 && width < 641 ){ + $(page_front).css("padding-top", "200px"); + } else if(width > 639 && width < 1025){ + $(page_front).css("padding-top", "155px"); + } else if(width > 1024){ + $(page_front).css("padding-top", "20px"); + } + } + $(window).resize( function () { + check_window_width(); + }); $(window).on("scroll", function () { var scrollTop = $(window).scrollTop(); if(scrollTop > 0){ $(sticky).addClass("fixed"); - if(width > 319 && width < 641 ){ - $(slideshow).css("margin-top", "140px"); - } else if(width > 639 && width < 1025){ -// $(slideshow).css("margin-top", "140px"); - } + check_window_width(); } // if(scrollTop == 0){