Skip to content

Instantly share code, notes, and snippets.

@adamo
Created December 22, 2015 12:05
Show Gist options
  • Select an option

  • Save adamo/39d9c0259e96ace8b7a1 to your computer and use it in GitHub Desktop.

Select an option

Save adamo/39d9c0259e96ace8b7a1 to your computer and use it in GitHub Desktop.

Revisions

  1. adamo created this gist Dec 22, 2015.
    14 changes: 14 additions & 0 deletions app.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    masthead = document.getElementById("masthead")
    height = 100
    stop = height

    window.onscroll = (e) ->
    scrollTop = (if (window.pageYOffset isnt `undefined`) then window.pageYOffset else (document.documentElement or document.body.parentNode or document.body).scrollTop)
    # console.log scrollTop

    # masthead.offsetTop;
    if scrollTop >= stop
    masthead.className = "site-header animated"
    else
    masthead.className = "site-header"
    return