Created
August 15, 2011 22:40
-
-
Save markng/1148062 to your computer and use it in GitHub Desktop.
aside scroller.js
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
jQuery(document).ready(function() { | |
var triggers_in_viewport = []; | |
checkTriggers(); | |
$(window).scroll(function(event) { | |
checkTriggers(); | |
}); | |
$('aside h3 a').click(function(event) { | |
showAside($(this).attr('href')); | |
}); | |
function showAside (aside_name) { | |
$('aside ul li div').hide(); | |
$('a[href="'+aside_name+'"]').parent().parent().find('div').show(); | |
} | |
function checkTriggers () { | |
triggers_in_viewport = $("a.aside_trigger:in-viewport"); | |
showAside('#'+$(triggers_in_viewport[0]).attr('name')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download the one from here : https://github.com/NV/jquery_viewport - that's what I tested it with.