Skip to content

Instantly share code, notes, and snippets.

@leonardorb
Created February 18, 2013 14:27
Show Gist options
  • Save leonardorb/4977799 to your computer and use it in GitHub Desktop.
Save leonardorb/4977799 to your computer and use it in GitHub Desktop.
define ['jquery'], ($) ->
fixedNavigation: (navOffsetTop) ->
navBar = $('nav.main-navigation')
scrollTop = $(window).scrollTop()
if scrollTop > navOffsetTop
navBar.css
'position' : 'fixed'
'top' : 0
'left' : 0
else
navBar.css
'position' : 'relative'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment