Created
April 3, 2013 17:25
-
-
Save ajself/5303287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --DEMO CODE-- | |
# Mimics the carousel sliding behavior found when clicking text links | |
# in a Google Drive Document that have comments | |
# <a href="#" class="screen" data-screen="1">Click!</a> | |
$(document).on 'click', '.screen', (evt) -> | |
evt.preventDefault() | |
console.log evt | |
screen = $(this).data 'screen' | |
# Drag the thumbs up the stack | |
$(".screens li").removeClass 'active' | |
$(".screen_#{screen}").addClass 'active' | |
current = $(".screen_#{screen}").position().top | |
target = $(evt.currentTarget).position().top | |
dest = (target - current) - 85 # 85 comes from the CSS height I applied to the thumbnail. | |
debug = | |
current: current | |
target: target | |
dest: dest | |
$('.screens').animate(top: dest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment