Answer the question
In order to leave comments, you need to log in
Why doesn't the function work in the fancybox 4 window?
$("#dbtn{id}").on("click", function () {
const fancybox{id} = new Fancybox([{
dragToClose: false,
src: "#downloadmodal{id}",
type: "inline",
closeButton: false,
dragToClose: false,
autoFocus: false,
},
]);
let timer; // пока пустая переменная
let x =10; // стартовое значение обратного отсчета
function countdown(){ // функция обратного отсчета
document.getElementById('rocket{id}').innerHTML = x;
x--; // уменьшаем число на единицу
if (x<0){
clearTimeout(timer); // таймер остановится на нуле
document.getElementById('rocket{id}').innerHTML = 'pipec{id}';
}
else {
timer = setTimeout(countdown, 1000);
}
}
fancybox{id}.on("done", (fancybox, slide) => {
countdown();
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question