亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Javascript 計數器從滾動開始

Javascript 計數器從滾動開始

郎朗坤 2021-06-30 08:23:50
我需要這個計數器從滾動開始,而不是之前。是否可以?function startCounter(){    $('.counter').each(function (index) {        $(this).prop('Counter',0).animate({            Counter: $(this).text()        }, {            duration: 2000,            easing: 'swing',            step: function (now) {                $(this).text(Math.round(now*10)/10);            }        });    });}   startCounter();<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><span class="counter">92.2</span>
查看完整描述

2 回答

?
牧羊人nacy

TA貢獻1862條經驗 獲得超7個贊

這將為您做到。


window.addEventListener('scroll', function(e) {

    startCounter();

});


查看完整回答
反對 回復 2021-07-01
  • 2 回答
  • 0 關注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號