zoukankan      html  css  js  c++  java
  • jquery淡入淡出无延迟代码

    <!DOCTYPE html>
    
    <html>
    
    <head>
    
    <script src="jquery.js"></script>
    
    <script>
    
    $(document).ready(function(){
    
      $("#button1").mouseover(function(){
    
           $(".div1").stop().animate({opacity:1},1000);
    
        $(".div2").stop().animate({opacity:1},1000);
    
        $(".div3").stop().animate({opacity:1},1000);
    
      });
    
     
    
      $("#button1").mouseleave(function(){
    
           $(".div1").stop().animate({opacity:0},1000);
    
        $(".div2").stop().animate({opacity:0},1000);
    
        $(".div3").stop().animate({opacity:0},1000);
    
      });
    
     
    
    });
    
    </script>
    
    </head>
    
     
    
    <body>
    
    <button id="button1">鼠标放在这里,使三个矩形淡入</button>
    
     
    
    <div class="div1" style="80px;height:80px;opacity:0;background-color:red;"></div>
    
    <br>
    
     
    
    <div class="div2" style="80px;height:80px;opacity:0;background-color:green;"></div>
    
    <br>
    
     
    
    <div class="div3" style="80px;height:80px;opacity:0;background-color:blue;"></div>
    
    </body>
    
    </html>

    另外

    function () { $(".div1").animate({ 'opacity': 0 },{ queue: false, duration: 1000 }); },


    function () { $(".div1").animate({ 'opacity': 1 }, { queue: false, duration: 1000 }); } 

    也可以。

  • 相关阅读:
    真的要努力了
    实事求是
    要努力了
    新征程,新目标
    真的要放弃了吗
    集中力量 主攻文科
    May the force be with me.
    记录级排名
    Android开发过程中git、repo、adb、grep等指令的使用
    Ubuntu环境变量设置
  • 原文地址:https://www.cnblogs.com/flying607/p/3495569.html
Copyright © 2011-2022 走看看