Alan Vitek

Simple jQuery Expand/Collapse Function

By Alan Vitek

August 28, 2014

I found this nifty post on Stack Overflow and decided to modify the code a bit.

Now, you simply attach a class of “toggle” to a parent element, and a class of “expander” to a child of that parent and  voila! You are done.

Thanks to my man Jerome for his help!

$(document).ready(function() {
$header = $(this);
$content = $header.children(".expander");
$content.slideToggle(500, function () {