2012-02-24 117 views

回答

1

这可以帮助你。

$('.div img').hover(
function(){ 
$(this).stop().animate({marginTop:'-25px',}, 300); 
}, 
function(){ 
$(this).stop().animate({marginTop:'0px',}, 300); 
} 

);

此查询的效果与您想要的效果相同。

为了解释代码

.div =类FO您的格或任何元件

function(){ 
$(this).stop().animate({marginTop:'-25px',}, 300); 
}, 

当图像是将鼠标悬停它将向上移动方向与marginTop的帮助这个代码装置:' - 25像素”

和代码

function(){ 
$(this).stop().animate({marginTop:'0px',}, 300); 
} 

它意味着,当它不是在悬停或鼠标移出图像时,它将返回到其原始位置。

您可以随时查看您想要的速度或想要的位置。