Shopify themes, liquid, logos, and UX
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 |
---|---|
142 | |
102 | |
79 | |
62 | |
61 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023