Hi guys,
I have a page with multiple uk-accordions (https://getuikit.com/docs/accordion). The problem is, that if an user opens an item in one uk-accordion and after that clicks on the next item in a different uk-accordion, the first item stays open. I want to change this in a way, that nevertheless where the user clicks, only one item should be visible.
I found a script and now I'm trying to adopt it:
$('.uk-accordion > li > a').click(function(e) {
// hide all div.uk-accordion-content
$('.uk-accordion-content').attr("hidden", true);
// remove class .uk-open
$('.uk-accordion > li').removeClass('uk-open');
$(this).addClass('uk-open');
// show selected accordion
var id = $(this).data('.uk-accordion');
var article = $('article[data-article=' + id + ']');
article.removeAttr('hidden');
});
$('.uk-accordion > li > a').click(function(e) {
e.preventDefault();
});
As you see, my problem is, that I'm not familiar with js.