jquery提供了animate来实现简单的动画效果

但单纯的jquery无法实现阴影的渐变(box-shadow属性渐变)

我们可以借助jquery.animate-shadow-min.js插件来实现

该插件分为jquery 1.7.2前及jquery 1.8.1 以后2个兼容版本,根据自己的jquery版本对应下载。

插件官方网址:http://www.bitstorm.org/jquery/shadow-animation/

(至少本文发布时(2012-10-16 17:33)该地址可访问)

本地下载地址:http://www.fayfox.com/js/jquery.animate-shadow-min.js (jquery1.7.2及以下)

示例代码


$(".post-list .post-list-item").live("mouseover", function(){
	$(this).stop().animate({
		"box-shadow" : "5px 5px 10px rgba(0, 0, 0, 0.25)",
	});
});
$(".post-list .post-list-item").live("mouseout", function(){
	$(this).stop().animate({
		"box-shadow": "2px 2px 10px #E7E5E6",
	});
});


效果见本站首页 传送门