<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;
}
<!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>
<!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>
<h1 class="title">Text</h1>
<style>
.title{
font-family: Arial;
-webkit-text-fill-color: transparent;
background: url(images.png);
background-size: 8%;
-webkit-background-clip: text;
}
</style>