jonagoldman
jonagoldman

Reputation: 8754

jQuery - Dynamically slide up Div over an image when mouse over it

I need to dynamically show a div over an image when mouse over. I need to do this for a lot of images so it needs to be dynamic. I looked at the code from www.foliostars.net :

jQuery.fn.masque = function(classe) {

$(this).hover(function(){
$(this).find(classe).stop().animate({height:'40px',opacity: '0.9'},400);
},function () { 
$(this).find(classe).stop().animate({height:'0',opacity: '0'}, 400);
});
}   
$(document).ready(function(){$('.thumb h2').masque('.masque');}); 

There is a way to modify this for using a div instead of a header?? There is maybe a better way to do it??

Thanks!

Upvotes: 0

Views: 4835

Answers (1)

Crescent Fresh
Crescent Fresh

Reputation: 116980

Sure. Give your divs a class "slider":

$(document).ready(function(){$('div.slider').masque('.masque');});

Upvotes: 1

Related Questions