Here’s a scenario…
I have a column. In the column i have multiple divs with text inside each one. A bit like a list of categories. Which ever one is SELECTED gains a different background colour.
What i would like to be able to do is use jquery so that when a different div is clicked on the background colour appears to slide behind the rest of the items until it reaches the one you selected.
Does anyone have any idea if this can be done? And if so any idea on Markup?
Any help is greatly appreciated.
There would be need to be a wrapper, a content container for each part and something that slides…
<div>
<div class='slider'></div>
<div>Content 1</div>
<div>Content 2</div>
</div>
Interesting request 🙂 You can do this with
.animate()and a little bit of CSS, like this:Try it out 🙂 Just click on either div to see the effect. See a demo here
The important bits:
.sliderdiv in the click handler.animate()to same offset/height as destination divz-indexso it shows up as the background.sliderdiv will work