我使用倒計時 DIV,當它到達 00:00:00 時,它會向自身添加一個類“timeisover”,我只想在它發生時向他的父級添加一個類。
<div class="parent-countdown">
<div class="countdown">
<!-- countdown elements here -->
</div>
</div>
我試過這個,但它不起作用。
$('.countdown').on('change', function() {
if($(this).hasClass('timeisover') {
$('.parent-countdown').addClass('disable-countdown');
)
});
所以我想我需要一個“事件監聽器”,它可以實時作業并永久檢查元素是否接收到這個類?我通常.on與click事件一起使用,但為此,我不確定如何進行:/所以任何幫助將不勝感激:)
uj5u.com熱心網友回復:
HurryTimer檔案說它有一個"hurryt:finished"EventName:
hurryt:finished:在計時器達到零后觸發。
$('.countdown').on('hurryt:finished', function(event, campaign){
$(this).closest('.parent-countdown').addClass('disable-countdown');
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/477022.html
