• jQuery clearQueue


    clearQueue()方法与clearQueue()方法结合;

    .clearQueue()可用于删除通过.queue()方法添加到通用jQuery序列的任何函数。

    示例:

    <!DOCTYPE html>
    <html>
    <head>
      <style>
      div { margin:3px; 40px; height:40px;
        position:absolute; left:0px; top:30px; 
        background:green; display:none; }
      div.newcolor { background:blue; }
      </style>
    
      <script type="text/javascript" src="/jquery/jquery.js"></script>
    </head>
    
    <body>
    
    <button id="start">开始</button>
    <button id="stop">停止</button>
    <div></div>
    
    <script>
    $("#start").click(function () {
      $("div").show("slow");
      $("div").animate({left:'+=200'},5000);
      $("div").queue(function () {
        $(this).addClass("newcolor");
        $(this).dequeue();
      });
      $("div").animate({left:'-=200'},1500);
      $("div").queue(function () {
        $(this).removeClass("newcolor");
        $(this).dequeue();
      });
      $("div").slideUp();
    });
    $("#stop").click(function () {
      $("div").clearQueue();
      $("div").stop();
    });
    </script>
    
    
    </body>
    </html>
    
  • 相关阅读:
    UVA 10618 Tango Tango Insurrection
    UVA 10118 Free Candies
    HDU 1024 Max Sum Plus Plus
    POJ 1984 Navigation Nightmare
    CODEVS 3546 矩阵链乘法
    UVA 1625 Color Length
    UVA 1347 Tour
    UVA 437 The Tower of Babylon
    UVA 1622 Robot
    UVA127-"Accordian" Patience(模拟)
  • 原文地址:https://www.cnblogs.com/sntetwt/p/3939189.html
Copyright © 2020-2023  润新知