Shopify themes, liquid, logos, and UX
Join us March 21 for an AMA on planning your 2023 marketing budget with 2H Media co-owners, Matt and Aron
Hello, I have javascript that is doing what i want. It toggles the sections to display when clicked. However, I want it to change display: none on the others when clicked on a link in the navigation for a specific section, instead of keep the last one open. Because it's only toggling on and off right now, so you have to click that button in the nav twice to hide it.
function showDiv(index) {
let one = document.getElementById('shopify-section-track_order_details');
let two = document.getElementById('shopify-section-returns_exchanges_details');
let three = document.getElementById('shopify-section-contact_us_details');
let four = document.getElementById('shopify-section-order_status_details');
let five = document.getElementById('shopify-section-shipping_returns_details');
let six = document.getElementById('shopify-section-corporate_details');
let seven = document.getElementById('shopify-section-product_help_details');
let eight = document.getElementById('shopify-section-ambassador_details');
let nine = document.getElementById('shopify-section-FAQ_details');
let x = document.getElementById('navArrow'+index);
let arrHelp = [one, two, three, four, five, six, seven, eight, nine];
let el = arrHelp[index - 1];
if (el.style.display != "block" && x.style.display != "inline-flex") {
el.style.display = "block";
x.style.display = "inline-flex";
} else {
el.style.display = "none";
x.style.display = "none";
}
}
User | RANK |
---|---|
177 | |
152 | |
87 | |
31 | |
29 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023