Skip to content

Instantly share code, notes, and snippets.

@tarolandia
Created May 30, 2013 15:21
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 tarolandia/5678714 to your computer and use it in GitHub Desktop.
Save tarolandia/5678714 to your computer and use it in GitHub Desktop.
window.init_scrollbars = (pane, scrollbar) ->
content = pane.find(".conversation-scroll-content")
if pane.height() > content.height()
scrollbar.css("opacity", "0.3")
else
scrollbar.draggable({
containment: "parent",
axis: 'y',
drag: (event, ui) ->
scrollbar_height = scrollbar.parent().height() - scrollbar.height()
margin = (pane.height() - content.height()) * (ui.position.top / scrollbar_height)
content.css("margin-top", margin + "px")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment