fixed conditionals to get the width and scrolltop dynamically and apply padding to...
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 3 Aug 2016 20:50:52 +0000 (16:50 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 3 Aug 2016 20:50:52 +0000 (16:50 -0400)
js/app.js
js/custom/pageSetup.js

index 44257a3..879594f 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -54,33 +54,39 @@ $(document).ready(function () {
     var slideshow = $("#slideshow");
     var body = $("body");
     var sticky = $(".sticky");
-    var width = $(window).width();
+    var width;
     var page_front = $(".page-front");
+    var scrollTop;
 
         
 
     
     $(window).resize( function () {
+        width = $(window).width();
+        scrollTop = $(window).scrollTop();
+        console.log("res" + scrollTop + " : " + 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");
+            $(page_front).css("padding-top", "60px");
         }
     });
     $(window).on("scroll", function () {
-        var scrollTop = $(window).scrollTop();
+        width = $(window).width();
+        scrollTop = $(window).scrollTop();
+        console.log("scr" + scrollTop + " : " + width);
         if(scrollTop > 0){
             $(sticky).addClass("fixed");
-            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");
-            }
-        } 
+        }
+        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", "60px");
+        }
 
     });
     
index d210608..84b3efb 100644 (file)
@@ -45,33 +45,39 @@ $(document).ready(function () {
     var slideshow = $("#slideshow");
     var body = $("body");
     var sticky = $(".sticky");
-    var width = $(window).width();
+    var width;
     var page_front = $(".page-front");
+    var scrollTop;
 
         
 
     
     $(window).resize( function () {
+        width = $(window).width();
+        scrollTop = $(window).scrollTop();
+        console.log("res" + scrollTop + " : " + 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");
+            $(page_front).css("padding-top", "60px");
         }
     });
     $(window).on("scroll", function () {
-        var scrollTop = $(window).scrollTop();
+        width = $(window).width();
+        scrollTop = $(window).scrollTop();
+        console.log("scr" + scrollTop + " : " + width);
         if(scrollTop > 0){
             $(sticky).addClass("fixed");
-            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");
-            }
-        } 
+        }
+        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", "60px");
+        }
 
     });