Log in

View Full Version : Resolved Style active internally-linked div



waterprism
01-23-2012, 12:32 AM
Hi,

Is it possible to style an internally-linked div when it becomes active (or perhaps when it becomes focused is a better phrase in this case)?

The use case: I've got an image slider at the top of the page. In the html span that slides over each image, I've got an internal link to a div on the page. (So, when someone clicks that link, they're linked to more information on the same page.) Is it possible to style that div so that when the visitor clicks to that div, the background color changes?

The current code is something like:


<div id="image_slider">
<img src="widget_1.jpg" />
<span>Blue widgets are great. <a href="index.html#blue_widgets">Learn more...</a></span>
</div>

<etc>
<etc>
<etc>

<div id="blue_widgets">
Blue widgets are great because they're blue. And also because they're widgets.
</div>

So when someone clicks that 'learn more' link, which obviously links them within the page to the 'blue_widgets' div further down, I'd also like the 'blue_widgets' div background color to change. Is there any way to do that?

Thanks for your time.