Posted - 12/15/2022 : 06:30:05
Hi Richard, I believe the trick will be to write the link with a javascript onclick event to do what the code does to the menu. If you go back to that page https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_accordion_symbol Add the following just above the closing body tag <script> function menulinkopen(mnuitm) { document.getElementsByClassName("accordion")[mnuitm].classList.toggle("active"); var accrdnxt = document.getElementsByClassName("accordion")[mnuitm].nextElementSibling; accrdnxt.style.maxHeight=accrdnxt.scrollHeight + "px"; } </script> <div style="margin-top:30px;"><button onclick="menulinkopen(1)">Open 2nd the Menu item</button></div>
</body> </html> Now click the RUN button and you will see my button appear and clicking it will open the 2nd accordion. To use this on your site, just use the function as it is and place that at the bottom of your bage before the closing </body> tag. Then create your link. <button onclick="menulinkopen( 1)">Open 2nd the Menu item</button> The key here though is the number placed in the function call. Most all computer code starts counting at zero, so a zero there will trigger the first accordion, a 1 the second, and a 2 the third and so on. Anyway, that should work for you and let me know how you get along. Thanks, David
Edited by - dbdave on 12/15/2022 06:32:42
|