FlexMarket
FlexMarket

Reputation: 155

Accordion Menu: First menu item open on page load

I am looking for some help with my accordion menu. I would like the first menu item to be open on page load (for my menu that would be "Products"). I am not sure how to achieve that with my current code.

Due to how long my CSS is, the entirety of my code and an example of my accordion menu is located at this fiddle:

JSFiddle

SAME CODE AS THE FIDDLE:

<div id="cssmenu">
<ul>
    <li><a href="#"><span>PRODUCTS</span></a>
        <ul>
            <li><a href="#">Heated Sample Line</a></li>
            <li><a href="#">Smoke Meter Line</a></li>
            <li><a href="#">Dual Rinse Cleaning Cart</a></li>
                            <li><a href="#">Heated Filter Housing</a></li>
            <li><a href="#">Insulated Blanket</a></li>
            <li><a href="#">Heated Industrial Blanket</a></li>
        </ul>
    </li>
    <li><a href="#"><span>COMPANY</span></a>
        <ul>
            <li><a href="#">About</a></li>
            <li><a href="#">Location</a></li>
        </ul>
    </li>
    <li><a href="#"><span>CONTACT</span></a></li>
</ul>

Upvotes: 1

Views: 428

Answers (1)

The fourth bird
The fourth bird

Reputation: 163207

Maybe you can programmatically trigger the click:

$('#cssmenu > ul > li > a')[0].click();

https://jsfiddle.net/6gbrLks7/2/

Upvotes: 1

Related Questions