I found this bit of code elsewhere on this forum and would like to know how I can get the same effect with a navigation bar.
So I would have 7 text links, and when you mouse over one, the image should slide to that bit of text. It would need to be in a different start position on each page (highlighting the current page on the nav bar)
This is the html:
<div class="box">
<a href"#">Home</a>
</div>
and the css:
.rollover a {
background: url(img/bg_nav_slide.png) no-repeat 0px 0px;
width: 920px;
height: 50px;
display: block;
}
.rollover a:hover {
background-position: 0px 40px 0px 0px;
}
.box {
background: url(img/bg_nav_slide.png) no-repeat;;
border: 0;
width: 920px;
height: 50px;
-webkit-transition: background 0.2s ease-in-out;
-moz-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
}
.box:hover {
background-position: 40px 0;
}
.box p {
text-indent: 2px;
}
That's the Lavalamp effect; you can find a pure CSS solution here:
http://codepen.io/iamvdo/pen/GsIxk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With