Skip to content
Snippets Groups Projects
Commit d665d296 authored by Hayley Corson-Dosch's avatar Hayley Corson-Dosch
Browse files

fix accordion button click event for symbol

parent 9ab34e9a
No related branches found
No related tags found
1 merge request!94Global maps layout
......@@ -79,7 +79,7 @@
<div v-for="item, index in subCategoryData.subThreatText" :key="index" class="accordion-container" :class="`${tab.tabContentTitleID}-accordion`">
<button class="accordion" :class="[`${tab.tabContentTitleID}-bkgd`, { 'active': item.activeOnLoad }]" @click="accordionClick">
<h4 class="accordion-button-text" v-html="item.heading"></h4>
<span class="symbol"></span>
<span class="accordion-button-text symbol"></span>
</button>
<div class="panel" :class="[{ 'active': item.activeOnLoad }]">
<p v-if="!primaryCategorySelected" v-html="item.text" />
......@@ -195,12 +195,11 @@
return new URL(`../assets/images/${file}`, import.meta.url).href
}
function accordionClick(event) {
// Pull class associated with target
// Pull class(es) associated with target
const targetClass = event.target.classList.value
console.log(targetClass)
// If the target is the button text, target the parent button element
// Otherwise if the target is the button, target it directly
const accordion = targetClass == 'accordion-button-text' ? event.target.parentElement : event.target
const accordion = targetClass.includes('accordion-button-text') ? event.target.parentElement : event.target
accordion.classList.toggle("active");
const panel = accordion.nextElementSibling;
panel.classList.toggle("active");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment