I'm super new to JS but I wanted a really simple accordion so I built one. For some reason I am at a loss when trying to add an easing effect to the opening / closing of it. Any help would be much appreciated. Thank you!
js code:
(function(){
// This class will be added to the expanded item
var activeItemClass = 'accordion-expanded';
var accordionItemSelector = '.accordion-section';
var toggleSelector = '.accordion-head';
$(toggleSelector).on('click', function() {
$(this)
.closest(accordionItemSelector) // go up to the accordion item element
.toggleClass(activeItemClass)
.siblings()
.removeClass(activeItemClass);
});
})();