const header = document.querySelector(".header");
const onWheel = () => {
if (window.pageYOffset > 0) {
header.classList.add("header--scroll");
} else {
header.classList.remove("header--scroll");
}
};
document.onwheel = () => {
onWheel();
};
filterBox.forEach(n => {
n.classList.toggle('none', ![ 'all', n.dataset.work ].includes(filterBtn));
});
const element = document.querySelector(`.js-filter-wrap a[data-filter="${конкретноеЗначение}"]`);
if (element) {
...
const element = [...elements].find(n => n.dataset.filter === конкретноеЗначение);
if (element) {
...
function counter(ms, className){
let counter = 0;
let interval = setInterval(() => {
document.querySelector(className).innerHTML = ++counter;
counter === 100 ? clearInterval(interval) : false;
}, ms)
}
counter(100, '.res')
const block = document.querySelector('.block')
let count = 0
const limit = 100
let interval = setInterval(()=>{
if(count <= limit) {
block.innerHTML = `${count}`
count++
} else {
clearInterval(interval)
}
},100)
infinite: false
.slick-disabled
..slick-arrow {
transition: opacity 0.3s ease;
}
.slick-arrow.slick-disabled {
opacity: 0;
}
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
</head>
<body>
<script>
function srav(){
var diag_nap_uchr = document.getElementById('pass-old');
var diag_osn = document.getElementById('pass-new');
if (diag_nap_uchr.value === diag_osn.value){
alert ("Совпадение");
}
}
</script>
<input type="password" id="pass-old" class="field-custom" placeholder="Старый пароль" name="password" value="123456">
<input type="password" id="pass-new" class="field-custom" placeholder="Новый пароль" name="password" oninput="srav()">
</body>
</html>
let isBtn1Clicked = false;
button1.addEventListener('click', () => isBtn1Clicked = true);
button2.addEventListener('click', () => {
if (isBtn1Clicked) {
// ...
}
});
button1.addEventListener('click', e => e.target.classList.add('clicked'));
button2.addEventListener('click', () => {
if (button1.classList.contains('clicked')) {
// ...
}
});
button2.disabled = true;
button1.addEventListener('click', () => button2.disabled = false);
button2.addEventListener('click', () => {
// ...
});
button2.hidden = true;
button1.addEventListener('click', () => button2.hidden = false);
button2.addEventListener('click', () => {
// ...
});
button1.addEventListener('click', () => {
button2.addEventListener('click', () => {
// ...
});
}, { once: true });