2009-02-07 127 views
0

當鼠標懸停時,我需要在圖像上動態顯示div。我需要爲許多圖像做到這一點,所以它需要動態。我看着從www.foliostars.net代碼:jQuery - 在鼠標懸停時動態滑動Div圖像

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');}); 

沒有修改這個使用一個div,而不是頭部的方式? 也許有更好的方法來做到這一點?

謝謝!

+0

這個代碼在IE7中有問題。也可能在IE6中。 – Jonathan 2009-02-08 21:27:57

回答

1

當然。給你的div一個類"slider"

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