Skip to content

Instantly share code, notes, and snippets.

@LukeChannings
Created August 15, 2012 16:32
Show Gist options
  • Save LukeChannings/3361418 to your computer and use it in GitHub Desktop.
Save LukeChannings/3361418 to your computer and use it in GitHub Desktop.
expand method
// expands an item to show its inner box.
// @param e {Event} the event that triggered the expansion.
var expand = function(e) {
e.preventDefault()
if ( ! opened ) {
open()
}
var target = e.target
while ( target.tagName !== "LI" ) {
target = target.parentNode
}
var $box = $(target).find("div")
if ( $(target).hasClass("active") ) {
closeActive()
$box.animate({
height: 0
}, 200, function() {
console.log("NOT CALLED IN FIREFOX.")
$(target).removeClass("active")
})
} else {
closeActive()
$box.animate({
height: 100
}, 200, function() {
console.log("NOT CALLED IN FIREFOX.")
$(target).addClass("active")
})
}
waitDuration = 1000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment