Created
August 15, 2012 16:32
-
-
Save LukeChannings/3361418 to your computer and use it in GitHub Desktop.
expand method
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
// 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