Private: Home › Forums › HTML Templates › Elvyre Retina Ready HTML5 Template › Accordions do not work: they do not contract › Reply To: Accordions do not work: they do not contract
November 12, 2014 at 7:44 pm
#1074
Participant
Hello,
This is the normal behavior of the accordion element – one is always open and can’t be closed unless the other item is selected.
If you want to open and close each element regardless on others, go to js/include.js and find the code:
/* ================ ACCORDION ================ */
(function() {
'use strict';
$('.accordion').on('click', '.title', function(event) {
event.preventDefault();
$(this).siblings('.accordion .active').next().slideUp('normal');
$(this).siblings('.accordion .title').removeClass("active");
if ($(this).next().is(':hidden') === true) {
$(this).next().slideDown('normal');
$(this).addClass("active");
}
});
$('.accordion .content').hide();
$('.accordion .active').next().slideDown('normal');
})();
change it to:
/* ================ ACCORDION ================ */
(function() {
'use strict';
$('.accordion').on('click', '.title', function(event) {
event.preventDefault();
$(this).next().slideToggle("normal");
});
$('.accordion .content').hide();
})();
Every element can now be opened and closed.
Robert