为什么 clearInterval() 在计时器 Js 中不起作用?
Why clearInterval() is not working in timer Js?
我正在接受与 js
合作的培训,其中一个项目是番茄钟。
计时器在主面板上运行良好,并在选项卡之间停止和切换。
但是如果你点击header和select里面的任何一个选项里面的时钟按钮,那么定时器不会停止,切换标签的时候也不会清零,加上结束的时候,会进入负.
timerInt = setInterval(timerF, 1000);
function timerF() {
if (sec === 0) {
sec = 59;
min--;
} else {
sec--;
}
if (sec < 10) {
timeSec.textContent = `0${sec}`;
} else {
timeSec.textContent = `${sec}`;
}
if (min < 10) {
timeMin.textContent = `0${min}`;
} else {
timeMin.textContent = `${min}`;
}
if (sec <= 0 && min <= 0) {
clearInterval(timerInt);
timeSec.textContent = `00`;
timeMin.textContent = `00`;
}
}
这是第一个选项 selected(20 分钟)时执行的代码:
time1.addEventListener("click", function () {
clearInterval(timerInt);
timeChoose = 20;
setTimes.classList.remove("active-time");
startBtn.removeAttribute("disabled", "disabled");
pomo.classList.add("active");
longBreak.classList.remove("active");
shortBreak.classList.remove("active");
startBtn.classList.add("active-btn");
timeSec.textContent = `00`;
timeMin.textContent = `20`;
startBtn.addEventListener("click", function () {
timer(timeChoose);
startBtn.setAttribute("disabled", "disabled");
});
});
Link 到示例页面,以便更容易理解我在说什么并查看代码。
请帮助我在 selection 之后让定时器正常工作
https://createchaoslab.github.io/pomo/
你叫 Timer
。但是没有定时器功能。
试试这个。
已编辑:
var tabs = document.querySelectorAll(".tab");
const first = document.querySelector(".first");
const timeMin = document.querySelector(".time-min");
const timeSec = document.querySelector(".time-sec");
var startBtn = document.querySelector(".start-btn");
const time1 = document.querySelector(".time1");
const time2 = document.querySelector(".time2");
const time3 = document.querySelector(".time3");
const setTimes = document.querySelector(".set-times");
const setTimesBtn = document.querySelector(".set-time img");
let timerInt;
let timeChoose=2;
function timer(timeChoose = 10) {
let sec = 0;
let min = timeChoose;
timerInt = setInterval(timerF, 1000);
function timerF() {
if (sec == 0) {
sec = 59;
min--;
} else {
sec--;
}
if (sec < 10) {
timeSec.innerHTML = `0${sec}`;
} else {
timeSec.innerHTML = `${sec}`;
}
if (min < 10) {
timeMin.innerHTML = `0${min}`;
} else {
timeMin.innerHTML = `${min}`;
}
if (sec <= 0 && min <= 0) {
clearInterval(timerInt);
timeSec.innerHTML = `00`;
timeMin.innerHTML = `00`;
}
}
}
tabs.forEach(tab => {
tab.addEventListener('click', function handleClick(event) {
clearInterval(timerInt);
[].forEach.call(tabs, function(el) {
el.classList.remove("active");
});
this.classList.add("active");
if(this.classList.contains('first')){
timeSec.innerHTML = `00`;
if (timeChoose < 10) {
timeMin.innerHTML = `0${timeChoose}`;
} else {
timeMin.innerHTML = `${timeChoose}`;
}
startBtn.classList.add("active-btn");
startBtn.removeAttribute("disabled", "disabled");
}
else{
if(this.classList.contains('second')){
timeSec.innerHTML = `00`;
timeMin.innerHTML = `01`;
timer(1);
}
else{
timeSec.innerHTML = `00`;
timeMin.innerHTML = `04`;
timer(4);
}
startBtn.classList.remove("active-btn");
}
});
});
function setT(min) {
clearInterval(timerInt);
timeChoose = min;
[].forEach.call(tabs, function(el) {
el.classList.remove("active");
});
setTimes.classList.remove("active-time");
startBtn.removeAttribute("disabled", "disabled");
first.classList.add("active");
startBtn.classList.add("active-btn");
timeSec.innerHTML = `00`;
timeMin.innerHTML = `${timeChoose}`;
}
time1.addEventListener("click", function () {
setT(20);
});
time2.addEventListener("click", function () {
setT(40);
});
time3.addEventListener("click", function () {
setT(60);
});
startBtn.addEventListener("click", function () {
timer(timeChoose);
startBtn.setAttribute("disabled", "disabled");
});
setTimesBtn.addEventListener("click", function () {
setTimes.classList.toggle("active-time");
});
body{
background: rgb(221, 99, 0);
}
.header {
border-bottom: 2px solid #fff;
margin-bottom: 70px;
}
.header-inner {
display: flex;
justify-content: space-between;
align-items: center;
}
.set-time {
display: flex;
}
.set-time img {
margin-left: 20px;
width: 40px;
height: 40px;
cursor: pointer;
padding: 0 10px;
}
.set-times {
visibility: hidden;
}
.set-times>* {
display: none;
}
.set-times.active-time>* {
display: block;
}
.set-times.active-time {
visibility: visible;
background: #ff8100;
display: flex;
padding: 10px 30px;
border-radius: 20px;
transition: all.4s;
-webkit-transition: all.4s;
-moz-transition: all.4s;
-ms-transition: all.4s;
-o-transition: all.4s;
}
.time-var {
padding: 0px 10px;
font-size: 20px;
color: #fff;
transition: all .3s;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
letter-spacing: 1px;
cursor: pointer;
}
.time-var:hover {
background-color: #f5812e;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
}
.time-var+.time-var {
margin-left: 15px;
}
.tabs{
display:block;
position:relative;
width: 100%;
height: 40px;
padding: 10px;
}
.tab{
display: inline-block;
text-align: center;
width: 60px;
transition: all .3s;
font-size: 20px;
font-weight: 700;
color: #fff;
padding: 7px 10px;
margin: 0 10px;
cursor: pointer;
background-color: transparent;
border: transparent;
outline: none;
-webkit-transition: all .3s;
}
.tab.active{
background:rgb(168, 60, 18);
}
#text {
display: flex;
color: #fff;
justify-content: center;
align-items: center;
}
.start-btn.active-btn {
margin-top: 10px;
border-radius: 5px;
background-color: rgb(255, 230, 210);
color: rgb(221, 99, 0);
font-size: 15px;
border: transparent;
outline: none;
padding: 10px 20px;
cursor: pointer;
visibility: visible;
}
.start-btn {
visibility: hidden;
}
<body>
<header class="header">
<div class="container">
<div class="header-inner">
<div class="set-time">
<div class="set-times">
<div class="time-var time1">20 min</div>
<div class="time-var time2">40 min</div>
<div class="time-var time3">60 min</div>
</div>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAkFBMVEX////u7u4AAAD+/v7t7e3v7+/9/f339/fz8/MEBAT09PTq6ur5+fkICAjU1NSIiIi6urp3d3eurq4wMDBiYmLc3NwXFxfOzs6cnJyBgYHFxcVTU1M1NTUoKChvb2/S0tJGRkaUlJSwsLClpaU8PDwaG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</div>
</div>
</div>
</header>
<div class="tabs">
<div class="tab first active">
tab1
</div>
<div class="tab second">
tab2
</div>
<div class="tab third">
tab3
</div>
</div>
<div>
<div id="text">
<div class="time-min">02</div> :
<div class="time-sec">00</div>
</div>
<button class="start-btn active-btn">START</button>
</div>
</body>
我正在接受与 js
合作的培训,其中一个项目是番茄钟。
计时器在主面板上运行良好,并在选项卡之间停止和切换。
但是如果你点击header和select里面的任何一个选项里面的时钟按钮,那么定时器不会停止,切换标签的时候也不会清零,加上结束的时候,会进入负.
timerInt = setInterval(timerF, 1000);
function timerF() {
if (sec === 0) {
sec = 59;
min--;
} else {
sec--;
}
if (sec < 10) {
timeSec.textContent = `0${sec}`;
} else {
timeSec.textContent = `${sec}`;
}
if (min < 10) {
timeMin.textContent = `0${min}`;
} else {
timeMin.textContent = `${min}`;
}
if (sec <= 0 && min <= 0) {
clearInterval(timerInt);
timeSec.textContent = `00`;
timeMin.textContent = `00`;
}
}
这是第一个选项 selected(20 分钟)时执行的代码:
time1.addEventListener("click", function () {
clearInterval(timerInt);
timeChoose = 20;
setTimes.classList.remove("active-time");
startBtn.removeAttribute("disabled", "disabled");
pomo.classList.add("active");
longBreak.classList.remove("active");
shortBreak.classList.remove("active");
startBtn.classList.add("active-btn");
timeSec.textContent = `00`;
timeMin.textContent = `20`;
startBtn.addEventListener("click", function () {
timer(timeChoose);
startBtn.setAttribute("disabled", "disabled");
});
});
Link 到示例页面,以便更容易理解我在说什么并查看代码。 请帮助我在 selection 之后让定时器正常工作 https://createchaoslab.github.io/pomo/
你叫 Timer
。但是没有定时器功能。
试试这个。
已编辑:
var tabs = document.querySelectorAll(".tab");
const first = document.querySelector(".first");
const timeMin = document.querySelector(".time-min");
const timeSec = document.querySelector(".time-sec");
var startBtn = document.querySelector(".start-btn");
const time1 = document.querySelector(".time1");
const time2 = document.querySelector(".time2");
const time3 = document.querySelector(".time3");
const setTimes = document.querySelector(".set-times");
const setTimesBtn = document.querySelector(".set-time img");
let timerInt;
let timeChoose=2;
function timer(timeChoose = 10) {
let sec = 0;
let min = timeChoose;
timerInt = setInterval(timerF, 1000);
function timerF() {
if (sec == 0) {
sec = 59;
min--;
} else {
sec--;
}
if (sec < 10) {
timeSec.innerHTML = `0${sec}`;
} else {
timeSec.innerHTML = `${sec}`;
}
if (min < 10) {
timeMin.innerHTML = `0${min}`;
} else {
timeMin.innerHTML = `${min}`;
}
if (sec <= 0 && min <= 0) {
clearInterval(timerInt);
timeSec.innerHTML = `00`;
timeMin.innerHTML = `00`;
}
}
}
tabs.forEach(tab => {
tab.addEventListener('click', function handleClick(event) {
clearInterval(timerInt);
[].forEach.call(tabs, function(el) {
el.classList.remove("active");
});
this.classList.add("active");
if(this.classList.contains('first')){
timeSec.innerHTML = `00`;
if (timeChoose < 10) {
timeMin.innerHTML = `0${timeChoose}`;
} else {
timeMin.innerHTML = `${timeChoose}`;
}
startBtn.classList.add("active-btn");
startBtn.removeAttribute("disabled", "disabled");
}
else{
if(this.classList.contains('second')){
timeSec.innerHTML = `00`;
timeMin.innerHTML = `01`;
timer(1);
}
else{
timeSec.innerHTML = `00`;
timeMin.innerHTML = `04`;
timer(4);
}
startBtn.classList.remove("active-btn");
}
});
});
function setT(min) {
clearInterval(timerInt);
timeChoose = min;
[].forEach.call(tabs, function(el) {
el.classList.remove("active");
});
setTimes.classList.remove("active-time");
startBtn.removeAttribute("disabled", "disabled");
first.classList.add("active");
startBtn.classList.add("active-btn");
timeSec.innerHTML = `00`;
timeMin.innerHTML = `${timeChoose}`;
}
time1.addEventListener("click", function () {
setT(20);
});
time2.addEventListener("click", function () {
setT(40);
});
time3.addEventListener("click", function () {
setT(60);
});
startBtn.addEventListener("click", function () {
timer(timeChoose);
startBtn.setAttribute("disabled", "disabled");
});
setTimesBtn.addEventListener("click", function () {
setTimes.classList.toggle("active-time");
});
body{
background: rgb(221, 99, 0);
}
.header {
border-bottom: 2px solid #fff;
margin-bottom: 70px;
}
.header-inner {
display: flex;
justify-content: space-between;
align-items: center;
}
.set-time {
display: flex;
}
.set-time img {
margin-left: 20px;
width: 40px;
height: 40px;
cursor: pointer;
padding: 0 10px;
}
.set-times {
visibility: hidden;
}
.set-times>* {
display: none;
}
.set-times.active-time>* {
display: block;
}
.set-times.active-time {
visibility: visible;
background: #ff8100;
display: flex;
padding: 10px 30px;
border-radius: 20px;
transition: all.4s;
-webkit-transition: all.4s;
-moz-transition: all.4s;
-ms-transition: all.4s;
-o-transition: all.4s;
}
.time-var {
padding: 0px 10px;
font-size: 20px;
color: #fff;
transition: all .3s;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
letter-spacing: 1px;
cursor: pointer;
}
.time-var:hover {
background-color: #f5812e;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
}
.time-var+.time-var {
margin-left: 15px;
}
.tabs{
display:block;
position:relative;
width: 100%;
height: 40px;
padding: 10px;
}
.tab{
display: inline-block;
text-align: center;
width: 60px;
transition: all .3s;
font-size: 20px;
font-weight: 700;
color: #fff;
padding: 7px 10px;
margin: 0 10px;
cursor: pointer;
background-color: transparent;
border: transparent;
outline: none;
-webkit-transition: all .3s;
}
.tab.active{
background:rgb(168, 60, 18);
}
#text {
display: flex;
color: #fff;
justify-content: center;
align-items: center;
}
.start-btn.active-btn {
margin-top: 10px;
border-radius: 5px;
background-color: rgb(255, 230, 210);
color: rgb(221, 99, 0);
font-size: 15px;
border: transparent;
outline: none;
padding: 10px 20px;
cursor: pointer;
visibility: visible;
}
.start-btn {
visibility: hidden;
}
<body>
<header class="header">
<div class="container">
<div class="header-inner">
<div class="set-time">
<div class="set-times">
<div class="time-var time1">20 min</div>
<div class="time-var time2">40 min</div>
<div class="time-var time3">60 min</div>
</div>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAkFBMVEX////u7u4AAAD+/v7t7e3v7+/9/f339/fz8/MEB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ZCdct6uOyquYFa4Rhf2jVdroS/9bVX4R3vnwfxH+Irz/4f8i/EV4/8P/RfiL8P6H/4vw/wLh/wDRQEjdOmcyUwAAAABJRU5ErkJggg==" alt="" />
</div>
</div>
</div>
</header>
<div class="tabs">
<div class="tab first active">
tab1
</div>
<div class="tab second">
tab2
</div>
<div class="tab third">
tab3
</div>
</div>
<div>
<div id="text">
<div class="time-min">02</div> :
<div class="time-sec">00</div>
</div>
<button class="start-btn active-btn">START</button>
</div>
</body>