const dropdown = document.querySelector('.dropdown-el');
const activeClass = 'expanded';
dropdown.addEventListener('click', e => {
e.preventDefault();
e.stopPropagation();
e.currentTarget.classList.toggle(activeClass);
e.target.previousElementSibling.checked = true;
});
document.addEventListener('click', () => dropdown.classList.remove(activeClass));
let observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.lastElementChild.classList.add(classes.image + "_active");
entry.target.lastElementChild.style.opacity = entry.intersectionRatio;
} else {
entry.target.lastElementChild.classList.remove(classes.image + "_active");
}
});
},
{
threshold: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
}
);
block.forEach((value) => observer.observe(value));
<Input handleInput={this.handleInput} />
onChange={this.props.handleInput}
const checkBoxAll = () => {
$(":checkbox").styler();
let checked = false;
$(".userProfile__select-All-Titles").click(function () {
if (checked) {
countCheckedInputs();
checked = false;
} else {
$(":checkbox").each(function () {
$(this).prop("checked", true).trigger("refresh");
});
checked = true;
countCheckedInputs();
}
return false;
});
$(".userProfile__delBTN").click(function () {
$(":checkbox").each(function () {
$(this).prop("checked", false).trigger("refresh");
});
checked = false;
countCheckedInputs();
});
};
checkBoxAll();
const countCheckedInputs = () => {
let checkedInput = $(".checked").length;
console.log(checkedInput);
if (checkedInput > 0) {
$(".userProfile__delBTN").addClass("userProfile__delBTN_active");
} else {
$(".userProfile__delBTN").removeClass("userProfile__delBTN_active");
}
};
$(".jq-checkbox").on("click", function () {
countCheckedInputs();
});
const $items = $('.item');
const SLICE_SIZE = 3;
$('.container').append(i => $items.slice(i * SLICE_SIZE, (i + 1) * SLICE_SIZE));
function playsl(slider, play_st, play_typ) {
if (play_st == true) {
if (play_typ == "slickNext") slider.slick("slickNext");
if (play_typ == "slickPrev") slider.slick("slickPrev");
}
}
$(".category__row")
.find(".slick-next")
.mouseenter(function () {
play_typ = "slickNext";
play_st = true;
slider = $(this).parent();
timerId = setInterval(function () {
playsl(slider, play_st, play_typ);
}, 220);
return false;
});
<img src="<путь-к-картинке>" alt="image">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta unde, quisquam voluptates libero praesentium, asperiores ratione ea deserunt at quaerat animi quo! Mollitia iusto nisi obcaecati alias similique, doloribus, eos.</p>
img {
float: left;
}
.header {
// описываете дефолтные стили
position: fixed;
left: 0;
top: 0;
width: 100%;
color: black;
background: white;
&--dark-mode {
// описываете стили для тёмного хедера, к примеру достаточно поменять только background
color: white;
background: black;
}
}
@mixin styleBlock($bgcolor) {
align-items: center;
font-size: 15px;
cursor: pointer;
border: 2px solid red;
background: $bgcolor;
}
.block-1 {
@include styleBlock(red);
}
.block-2 {
@include styleBlock(green);
}