From 0999f02334725f6dff65947e5d2b8d4c221a7237 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Mon, 4 Apr 2016 10:45:45 +0200 Subject: [PATCH] Again more style and parallax work. --- app/assets/images/bwcartoon-m.svg | 1196 ++++++++++++++++++++++++ app/assets/images/heckert_gnu.svg | 94 ++ app/assets/javascripts/parallax.coffee | 11 +- app/views/layouts/application.html.erb | 4 +- app/views/welcome/index.html.erb | 1 + 5 files changed, 1300 insertions(+), 6 deletions(-) create mode 100644 app/assets/images/bwcartoon-m.svg create mode 100644 app/assets/images/heckert_gnu.svg diff --git a/app/assets/images/bwcartoon-m.svg b/app/assets/images/bwcartoon-m.svg new file mode 100644 index 0000000..c86fed1 --- /dev/null +++ b/app/assets/images/bwcartoon-m.svg @@ -0,0 +1,1196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/heckert_gnu.svg b/app/assets/images/heckert_gnu.svg new file mode 100644 index 0000000..06403cb --- /dev/null +++ b/app/assets/images/heckert_gnu.svg @@ -0,0 +1,94 @@ + + + + + + + + + image/svg+xml + + + + + Aurelio A. Hecker <aurium@gmail.com> + + + GNU Head + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/javascripts/parallax.coffee b/app/assets/javascripts/parallax.coffee index 7ed9ef3..b75e9d4 100644 --- a/app/assets/javascripts/parallax.coffee +++ b/app/assets/javascripts/parallax.coffee @@ -31,10 +31,13 @@ App.init = -> App.scroll = -> v_scroll = $(document).scrollTop() section = Math.floor(v_scroll / $(window).innerHeight()) - bg_pos = (v_scroll-(section*$(window).innerHeight()))/2 - $($(".section")[section]).css( - "background-position", - "center -" + bg_pos + "px") + [section, section+1].forEach (section) -> + bg_pos = -((v_scroll-(section*$(window).innerHeight()))/2) + section_element = $($(".section")[section]) + if section_element and section_element.css("background-image") != "none" + section_element.css( + "background-position", + "center " + bg_pos + "px") $(document).on "page:change", -> App.init() diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b9a5c6e..590f3c3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,8 +12,8 @@