Commit d6b91da86cd37c2f1d6b837bc2331094c3a5af40
1 parent
d7fe22c7
some progress with the parallax stuff...
Showing
1 changed file
with
3 additions
and
7 deletions
... | ... | @@ -7,9 +7,7 @@ window.App ||= {} |
7 | 7 | content_top = content_left = width_delta = height_delta = 0 |
8 | 8 | |
9 | 9 | App.init = -> |
10 | - content_left = parseFloat($('#content').css("left")) | |
11 | 10 | content_top = parseFloat($('#content').css("top")) |
12 | - width_delta = ($(document).width()-$(window).width())/2 | |
13 | 11 | height_delta = ($(document).height()-$(window).height())/2 |
14 | 12 | ### |
15 | 13 | window.scrollTo(width_delta, height_delta) |
... | ... | @@ -17,11 +15,9 @@ App.init = -> |
17 | 15 | |
18 | 16 | App.scroll = -> |
19 | 17 | v_scroll = $(document).scrollTop() |
20 | - h_scroll = $(document).scrollLeft() | |
21 | - ### | |
22 | - $("#content").css("left", content_left-((h_scroll-width_delta)/8)) | |
23 | - $("#content").css("top", content_top-((v_scroll-height_delta)/8)) | |
24 | - ### | |
18 | + section = Math.floor(v_scroll / 1000) | |
19 | + $(".background").css("top", 0) | |
20 | + $($(".background")[section]).css("top", (v_scroll-(section*1000))/2) | |
25 | 21 | |
26 | 22 | $(document).on "page:change", -> |
27 | 23 | App.init() | ... | ... |
Please
register
or
login
to post a comment