I'm new to jQuery but I managed to get something working. The only thing I can't really figure out is how to make a function of this script so I can reuse it on several divs.
The idea is to have a tumbnail, when you hover the tumbnail a infolayer will fade in over the tumbnail. When your mouse leaves the tumbnail, the info layer will disappear again.
I have the following code:
$('#hover').mouseenter(function() {
$('#1').animate({ opacity: 'show' }, 300);
}).mouseleave(function() {
$('#1').animate({ opacity: 'hide' }, 800);
});
And the html:
<div class="work_tumb" id="hover">
<div class="work_overlay" id="1">This is the info overlay</div>
</div>
This code works perfectly. Now I just want to make a function from this so it's reusable. Can you guys help me out with this??