溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Countdown-倒計時插件

發布時間:2020-06-24 16:31:21 來源:網絡 閱讀:452 作者:renyiqiu 欄目:web開發

今天我介紹的就是類似這種功能的jquery插件,他不僅能實現上面所述的功能,而且在每個倒計時數字實現動畫的過渡效果。


文章詳情和下載鏈接


$(document).ready(function () {
          /* 延遲函數  */
          jQuery.fn.delay = function (time, func) {
              return this.each(function () {
                  setTimeout(func, time);
              });
          };
          jQuery.fn.countDown = function (settings, to) {
              settings = jQuery.extend({
                  startFontSize: '36px',
                  endFontSize: '12px',
                  duration: 1000,
                  startNumber: 10,
                  endNumber: 0,
                  callBack: function () { }
              }, settings);
              return this.each(function () {
                  if (!to && to != settings.endNumber) { to = settings.startNumber; }
                  //設定倒計時開始的號碼
                  $(this).text(to).css('fontSize', settings.startFontSize);
                  //頁面動畫
                  $(this).animate({
                      'fontSize': settings.endFontSize
                  }, settings.duration, '', function () {
                      if (to > settings.endNumber + 1) {
                          $(this).css('fontSize', settings.startFontSize).text(to - 1).countDown(settings, to - 1);
                      }
                      else {
                          settings.callBack(this);
                      }
                  });
              });
          };
          //使用
          $('#countdown').countDown({
              startNumber: 10,
              callBack: function (me) {
                  $(me).text('All done! This is where you give the reward!').css('color', '#090');
              }
          });
      });




向AI問一下細節
推薦閱讀:
  1. Android倒計時
  2. JS倒計時

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女