From 44efc3ff6164fc44a690431ae288afea51da678f Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 3 Aug 2016 16:39:50 -0400 Subject: [PATCH] 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 --- js/app.js | 19 ++++++++++++++----- js/custom/pageSetup.js | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) 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){ -- 2.17.1