From cbdfebbabf2ce2d0c51ace2aa476daae572c87f4 Mon Sep 17 00:00:00 2001 From: Dmitri K Date: Sun, 28 Aug 2016 00:07:19 -0400 Subject: [PATCH] Adding parallax BG because everybody loves that shit and I do too --- script.js | 5 ++++- style.css | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index 83ed500..a7b27db 100644 --- a/script.js +++ b/script.js @@ -3,8 +3,11 @@ $(function(){ // Fade the top bar to black when scrolling beyond 30% of the first screen by adding .dark $(window).on('scroll', function(e){ - var isDark = $("body").scrollTop() > $('section').first().height() * 0.3; + var top = $("body").scrollTop(); + var isDark = top > $('#cover').first().height() * 0.3; $('nav').toggleClass('dark', isDark); + + $('#cover').css({"background-position-y": -top/2 + "px"}) }).trigger('scroll'); }) \ No newline at end of file diff --git a/style.css b/style.css index 3fc7f6a..9b82c47 100644 --- a/style.css +++ b/style.css @@ -138,8 +138,6 @@ section#cover .underline{ .divider{ min-height: 6em; background: rgba(250, 250, 250, 0.85); - /*background: url(http://thumb7.shutterstock.com/display_pic_with_logo/2785297/382739011/stock-photo-macro-shot-of-beer-and-beer-foam-in-glass-ideal-for-use-as-a-background-or-backdrop-in-your-382739011.jpg) center top repeat-x; - */ } .divider.by-three .container > div{