There is a simple slider, when you click on the next button, the next picture is turned on. Is it possible to somehow make a delay between clicks so that the new picture has time to take its place? Type made a click, and the next click the program will respond only after a second.
- If the question is whether it is possible - the answer is possible. If you want more details, just ask: "how to do". (immediately answering the second question, for example, when clicking to set a timer, and a variable (For example, CanSlide = false), register "CanSlide = true" in the timer.
|
1 answer
You can somehow ...
var button = document.querySelector("button"), d_num = document.getElementById("num"), num = +document.getElementById("num").textContent; button.addEventListener("click", () => { num++; d_num.textContent = num; button.setAttribute("disabled", "disabled"); setTimeout(() => { button.removeAttribute("disabled"); }, 1000) }); <div id="num">0</div> <button>Click me</button> - I apologize for not being on time, but I encountered the following problem: the first two clicks the algorithm works without problems, further, it either sets disabled for> 1000ms or does not set at all, can you help with this problem? - Nikita
- @Nikita, without a code, nothing is clear, ask extra. question, and then we'll see - meine
|