1
我有一個圖像,當我鼠標懸停,我想另一個圖像從底部向上「滑動」第一個圖像。在鼠標懸停時,圖像應該再次消失,從上到下滑動,再次顯示第一張圖像。鼠標懸停圖像並顯示另一個,使用jQuery
如何用jQuery做到這一點?我試過animate
和slidetoggle
,但我無法使它工作。
編輯:解
<div class="image" style="width:90px;height:67px;position:relative;overflow:hidden">
<a href="#">
<img style="position:absolute;top:0;left;0;z-index:1;" class="first" src="images/stories/logos/in-dialoog.gif" alt="logo" />
<img style="position:absolute;top:0;left:0;z-index:0;" class="second" src="images/stories/logos/c-riders.gif" alt="logo" />
</a>
</div>
$('.image').mouseenter(function(){
$('.first').stop().animate({
top: '56px'
}, 800, function() {
// Animation complete.
});
});
$('.image').mouseleave(function(){
$('.first').stop().animate({
top: '0'
}, 800, function() {
// Animation complete.
});
});
請問您試過的代碼。 – Vivek 2011-05-25 11:07:21