Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NathanQ/5521510 to your computer and use it in GitHub Desktop.
Save NathanQ/5521510 to your computer and use it in GitHub Desktop.
Used with a pair of corresponding lists on http://www.unionindoor.com/locations/.
var firstlocationli = $('.location li:first').position();
$('.location li').click(function(){
$(this).addClass('selected');
$(this).siblings('li').removeClass('selected');
$(".locations").hide();
$(".locations#" + $(this).attr("id") + "_list").show();
var position = $(this).position();
$('.locations').css('margin-top', position.top - firstlocationli.top + 'px');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment