Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charlieschwabacher/d23f53da89c720b5660c to your computer and use it in GitHub Desktop.
Save charlieschwabacher/d23f53da89c720b5660c to your computer and use it in GitHub Desktop.
# setup variables
$window = $ window
$section = $ '.tour-section'
$intro = $ '.tour-intro'
adjustWindow = ->
winH = $window.height()
win2 = winH * 2
winH = 550 if winH <= 550
$intro.height winH
$section.height winH * 2
$body = $ "body"
$body.attr "data-#{winH}", $body.attr("data-intro")
for i in [1..8]
$body.attr "data-#{win2 * i}", $body.attr "data-section-#{i}"
$body.removeAttr "data-section-#{i}"
$body.attr "data-#{winH}", $body.attr 'data-intro'
$body.removeAttr 'data-intro'
adjustWindow()
$window.on "resize", ->
adjustWindow()
%body{"data-intro" => "background: rgb(81, 86, 109)",
"data-section-1" => "background: rgb(69, 82, 121)",
"data-section-2" => "background: rgb(94, 107, 151)",
"data-section-3" => "background: rgb(68, 74, 100)",
"data-section-4" => "background: rgb(94, 108, 154)",
"data-section-5" => "background: rgb(67, 72, 95)",
"data-section-6" => "background: rgb(65, 73, 104)",
"data-section-7" => "background: rgb(41, 50, 71)",
"data-section-8" => "background: rgb(94, 109, 157)"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment