这是使按钮可见的代码,我想显示延迟时间。我该怎么表现出来?
{{1}}
{{1}}
答案 0 :(得分:0)
#skip{
display:none
}

<label id="countdown"style="float:Right"></label>
<a href="#" style="float:Right" id="skip">
<i class="fas fa-caret-right fa-lg"></i>
Skip
</a>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function() {
var countdown = $('#countdown');
var counter = 11;
var idTimeout = 0;
idTimeout = setInterval (function (item){
countdown.text(--counter);
},1000);
//convert delay in promise to detect when delay is finished
var delayDone = $('#skip')
.hide()
.delay(10000)
.promise();
//when delay is done by function then() we can appply our code
delayDone.then(function(){
clearTimeout(idTimeout);
countdown.fadeOut('fast');
//"this" refers to $('#skip') which on the top ..
//...of the JQUERY chain call
this.fadeIn(2200);//== $('#skip').fadeIn(2200);
});
});
</script>
&#13;