//получаем элемент внутри которого есть текст
const el = document.querySelector('.test');
//убираем по краям пустоту. Создаем массив по переносу строки и смотрим длину массива
const count = el.textContent.trim().split("\n").length;
if (count === 1) {
//code
} else if (count === 2) {
//code
}
let flag = true;
$('.technology-timeline-content__section').mousedown(function() {
$(this).addClass('mousedown');
if ($('.technology-timeline-content__section').hasClass('mousedown')) {
console.log('стоять');
flag = false;
}
});
$(window).mouseup(function() {
if ($('.technology-timeline-content__section').hasClass('mousedown')) {
$('.technology-timeline-content__section').removeClass('mousedown');
flag = true;
autoplay();
console.log('пошла');
}
});
function autoplay() {
if (!flag) return;
//code
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="style.css" id="styles">
</head>
<body>
<button class="change style">Сменить стили</button>
<script>
const link = document.querySelector('#styles');
const button = document.querySelector('.change');
button.onclick = ({ target }) => {
if (target.classList.contains('style')) {
target.classList.remove('style');
link.href = 'blind.css';
}
console.log(link.href)
}
</script>
</body>
</html>
$(document).ready(function () {
$("#showIB").on("click", function (event) {
event.stopPropagation();
$("#sampleCard")
.animate({
right: 0,
opacity: 1
})
.css("display", "inline");
$('body').css("overflow","hidden");
});
$("#sampleCard").on("click", function (event) {
event.stopPropagation();
});
});
$(document).on("click", function () {
$("#sampleCard").animate(
{
right: "-130%",
opacity: 0
},
{
complete: function () {
$(this).css("display", "none");
}
}
);
$('body').css("overflow","auto");
});
$(window).resize(function(e) {
let width = e.target.innerWidth
if(width < 1200) {
//меняем элементы в html
}
});