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 :
我需要在鼠标悬停时动态显示图像上的div。我需要为很多图像做这个,所以它需要是动态的。我查看了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??
有一种方法来修改这个使用div而不是标题?有可能有更好的方法吗?
Thanks!
1 个解决方案
#1
Sure. Give your divs a class "slider"
:
当然。给你的div一个类“滑块”:
$(document).ready(function(){$('div.slider').masque('.masque');});
#1
Sure. Give your divs a class "slider"
:
当然。给你的div一个类“滑块”:
$(document).ready(function(){$('div.slider').masque('.masque');});