<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1 class="txt">Текст</h1>
</body>
<script>
console.log($(".txt").width());
</script>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="header"><p>Меню</p></div>
</body>
<style>
.header{
width: 100%;
height: 80px;
transition-duration: 1s;
z-index: 2;
position: fixed;
background: rgba(0, 0, 0, 0);
}
body{
min-height: 2000px;
}
</style>
<script>
let header = document.querySelector(".header")
window.onscroll = function(){
if(window.scrollY > 100){
header.style.background = "#000"
}
else{
header.style.background = "rgba(0, 0, 0, 0)"
}
}
</script>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div><p>Is typing <span class="dot1">.</span>
<span class="dot2">.</span>
<span class="dot3">.</span></p></div>
</body>
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat:100,200,300,regular,500,600,700,800,900,100italic,200italic,300italic,italic,500italic,600italic,700italic,800italic,900italic);
html{
font-family: Montserrat;
}
.dot1{
transition-delay: 0.1s;
opacity: 0;
transition-duration: 0.3s;
}
.active-dot1{
opacity: 1;
transition-delay: 0.1s;
transition-duration: 0.3s;
}
.dot2{
transition-delay: 0.2s;
opacity: 0;
transition-duration: 0.3s;
}
.active-dot2{
transition-delay: 0.2s;
opacity: 1;
transition-duration: 0.3s;
}
.dot3{
transition-delay: 0.3s;
opacity: 0;
transition-duration: 0.3s;
}
.active-dot3{
transition-delay: 0.3s;
opacity: 1;
transition-duration: 0.3s;
}
</style>
<script>
let dot1 = document.querySelector(".dot1")
let dot2 = document.querySelector(".dot2")
let dot3 = document.querySelector(".dot3")
setInterval(() => {
dot1.classList.toggle("active-dot1")
}, 500);
setInterval(() => {
dot2.classList.toggle("active-dot2")
}, 500);
setInterval(() => {
dot3.classList.toggle("active-dot3")
}, 500);
</script>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<input type="text" name="" id="" class="input">
<button class="btn">Отправить</button>
</body>
<script>
let btn = document.querySelector(".btn")
let inputs = Array.from(document.querySelectorAll(".input"))
btn.onclick = function(){
let newArray = inputs.filter(function(input){
return input.value == ""
})
if(newArray == ""){
btn.style.background = "skyblue"
}
else{
btn.style.background = "tomato"
}
}
</script>
</html>
<script>
function onEntry(entry) {
entry.forEach(change => {
if (change.isIntersecting) {
change.target.classList.add('element-show');
}
});
}
let options = {
threshold: [0.5] };
let observer = new IntersectionObserver(onEntry, options);
let elements = document.querySelectorAll('.element-animation');
for (let elm of elements) {
observer.observe(elm);
}
</script>
.element-animation{
top: 0px;
opacity: 0;
position: relative;
}
.element-animation.element-show{
position: relative;
top: -20px;
opacity: 1;
transition-duration: 1.4s;
}