You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
701 B
28 lines
701 B
#
|
|
# OK, this is not really a parallax... I just want to see my content move
|
|
# somewhat faster than the background... hey, ho, let's go
|
|
#
|
|
window.App ||= {}
|
|
|
|
content_top = content_left = width_delta = height_delta = 0
|
|
|
|
App.init = ->
|
|
content_top = parseFloat($('#content').css("top"))
|
|
height_delta = ($(document).height()-$(window).height())/2
|
|
###
|
|
window.scrollTo(width_delta, height_delta)
|
|
###
|
|
|
|
App.scroll = ->
|
|
v_scroll = $(document).scrollTop()
|
|
section = Math.floor(v_scroll / 1000)
|
|
$(".background").css("top", 0)
|
|
$($(".background")[section]).css("top", (v_scroll-(section*1000))/2)
|
|
|
|
$(document).on "page:change", ->
|
|
App.init()
|
|
|
|
$(window).on "scroll", ->
|
|
App.scroll()
|
|
|
|
# vim: set ts=2 sw=2:
|