Monday, March 28, 2011

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

Hi, 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!

From stackoverflow
  • Sure. Give your divs a class "slider":

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

0 comments:

Post a Comment