为什么不起作用?We
、Members
和Listen
是将您重定向到另一个页面的标题,我的意图是当您的鼠标位于其中一个按钮上时使它们跳动。
HTML:
<a id="asd" class="asd" href="a.html">We</a>
<a> </a>
<a id="asd" class="asd" href="b.html">Members</a>
<a id="asd" class="asd" href="c.html">Listen</a>
jQuery:
$(document).ready(function() {
$(".asd").mouseenter(function(){
$(".asd").effect( "bounce",
{times:3}, 300 );
});
});
使用hover/mousenter进行动画是很有趣的,但至少使用CSS可以进行更多控制。试试这个?
.asd{
position: relative
}
.asd:hover{
animation: bounceText .5s;
-webkit-animation: bounceText .5s;
}
@-webkit-keyframes bounceText {
0% {top: 0px;}
50% {top: 10px;}
100% {top: 0px;}
}
@keyframes bounceText {
0% {top: 0px;}
50% {top: 10px;}
100% {top: 0px;}
}