Created
February 9, 2009 06:47
-
-
Save benhoskings/60684 to your computer and use it in GitHub Desktop.
This file contains 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
var handle_list_link = function() { | |
// Get the currently displayed element in the list, if there is one | |
var cur = $(this).parents('ul.list:first').children('li.cur'); | |
var cur_clicked = $(this).is('.cur'); | |
// If there is a current element, hide it | |
if (cur.length != 0) { | |
cur.removeClass('cur') | |
.children('a.cur').removeClass('cur') | |
.siblings('.data:visible').hide('drop', {direction: 'down'}); | |
} | |
// Show the element that was clicked, unless it was the current element | |
if (!cur_clicked) { | |
$(this).addClass('cur') | |
.parents('li:first').addClass('cur') | |
.children('.data').fadeIn(); | |
} | |
}; | |
$(function() { | |
$('ul.list a.trigger').click(handle_list_link); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment