主要是备忘一下animate的参数设置方法
核心代码如下:
$(function(){
$("#flash2 li a").hover(
function(){
$(this).animate(
{ paddingLeft:"40px" },
{duration: 400,
easing: "easeOutQuint",
complete:function(){$(this).addClass("yel")}
}
) },
function(){
$(this).animate(
{ paddingLeft:"10px" },
{duration: 400,
easing: "easeOutQuint",
complete:function(){$(this).removeClass("yel")}
}
) }
)
})
$("#flash2 li a").hover(
function(){
$(this).animate(
{ paddingLeft:"40px" },
{duration: 400,
easing: "easeOutQuint",
complete:function(){$(this).addClass("yel")}
}
) },
function(){
$(this).animate(
{ paddingLeft:"10px" },
{duration: 400,
easing: "easeOutQuint",
complete:function(){$(this).removeClass("yel")}
}
) }
)
})
样式表:
a{ font-weight:900; padding:4px 6px;}
a:hover{ color:#fff;}
script{ display:block;}
.flash{ width:400px; padding:10px; list-style:none; clear:both;}
.flash li{ font-family:Arial, Helvetica, sans-serif; font-size:14px; border-bottom:1px solid #ddd; clear:both; margin:0;}
.flash li a{padding-left:10px; background:#f0f0f0; display:block; padding-right:10px;line-height:26px; height:26px;}
.flash li a:hover{ color:#fff; background:#f0c;}
.flash li a.yel{ color:#ff0;}
a:hover{ color:#fff;}
script{ display:block;}
.flash{ width:400px; padding:10px; list-style:none; clear:both;}
.flash li{ font-family:Arial, Helvetica, sans-serif; font-size:14px; border-bottom:1px solid #ddd; clear:both; margin:0;}
.flash li a{padding-left:10px; background:#f0f0f0; display:block; padding-right:10px;line-height:26px; height:26px;}
.flash li a:hover{ color:#fff; background:#f0c;}
.flash li a.yel{ color:#ff0;}