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 |
---|---|
154 | |
105 | |
92 | |
58 | |
51 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By