you gave me some code few months ago to close accordions on small phone screens
However, since the latest update this no longer works, can we modify it to work again?
you gave me some code few months ago to close accordions on small phone screens
However, since the latest update this no longer works, can we modify it to work again?
Hello There,
Thanks for writing in! I have checked your site and it seems you have applied the element ID incorrectly. Please understand that element ID must be unique. There can be no duplicate ID. Each element must have different ID. Duplicate IDs will result to a conflict which is why it is not working. I would recommend that you remove the ID and remove the duplicates. And then update the JS code and make use of this instead:
/*close accordians on mobile screen*/
jQuery(function($) {
$(window).on("resize", function () {
if($(this).width() <= 767) {
$('#my-accordion .x-accordion-body').removeClass('in');
}
}).resize();
});
Please let us know how it goes.
So would I need to enter a separate JS code like this for every accordion, just change the #my-accordion part to the ID of another ID ?
I.E. If I have 6 accordions I will need 6 distinct IDs and 6 seperate javascript codes
Hey there,
You may try this code instead for all accordions:
/*close accordians on mobile screen*/
jQuery(function($) {
$(window).on("resize", function () {
if($(this).width() <= 767) {
$('.x-accordion .x-accordion-body').removeClass('in');
}
}).resize();
});
Let us know how this goes!