为什么不是't在jquery中处理这种反弹效应

Why isn't working this bounce effect in jquery?

本文关键字:处理 jquery 为什么不      更新时间:2023-09-26

为什么不起作用?WeMembersListen是将您重定向到另一个页面的标题,我的意图是当您的鼠标位于其中一个按钮上时使它们跳动。

HTML:

 <a id="asd" class="asd" href="a.html">We</a>
<a>&nbsp;&nbsp;&nbsp;&nbsp; </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;}
}