Skip to content

Instantly share code, notes, and snippets.

@epmatsw
Created June 19, 2012 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epmatsw/2956755 to your computer and use it in GitHub Desktop.
Save epmatsw/2956755 to your computer and use it in GitHub Desktop.
content = @elements.oContent
nowAtTop = (content.scrollTop() is 0)
nowAtBottom = (content.scrollTop() >= content.children('ul').height() - content.height())
if nowAtTop is @atTop and nowAtBottom is @atBottom
return
@atTop = nowAtTop
@atBottom = nowAtBottom
shadowSize = '30px'
shadowColor = '#000'
shadow = 'none'
if not nowAtTop and not nowAtBottom
shadow = "inset 0 #{shadowSize} #{shadowSize} -#{shadowSize} #{shadowColor}, inset 0 -#{shadowSize} #{shadowSize} -#{shadowSize} #{shadowColor}"
else if nowAtBottom
shadow = "inset 0 #{shadowSize} #{shadowSize} -#{shadowSize} #{shadowColor}"
else if nowAtTop
shadow = "inset 0 -#{shadowSize} #{shadowSize} -#{shadowSize} #{shadowColor}"
content.css
'-webkit-box-shadow': shadow
'-moz-box-shadow': shadow
'box-shadow': shadow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment