I have a link bar pinned to the right-hand side of the screen. As the user scrolls, the bullet points grow depending on what section the user has scrolled to (acts as an anchor to help users navigate up/down the page.
I have tags next to each bullet point, displaying a description of each link/scroll point. I want to display each span tag ONLY when the respective link/bullet-point is highlighted (when the class="selected" is set on the "li" element).
How can I detect the class="selected" on the li element, and display the contents of the respective span tags if class="selected" is present?
<div id="sidemenu">
<ul>
<li id="welcomeLi" class="selected"><table><tr><td><span>Welcome</span></td><td><a href="#home">•</a></td></tr></table></li>
<li id="mantraLi"><table><tr><td><span>Our mantra</span></td><td><a href="#mantra">•</a></td></tr></table></li>
<li id="softwareLi"><table><tr><td><span>Our software</span></td><td><a href="#software">•</a></td></tr></table></li>
<li id="involvedLi"><table><tr><td><span>Get involved</span></td><td><a href="#involved">•</a></td></tr></table></li>
<li id="contactLi"><table><tr><td><span>Contact us</span></td><td><a href="#contact">•</a></td></tr></table></li>
</ul>