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);
}
.element-animation{
top: 0px;
opacity: 0;
position: relative;
}
.element-animation.element-show{
position: relative;
top: 20px;
opacity: 1;
transition-duration: 1.4s;
}
.info-head.menu-margin{
margin-top: -140px;
transition-duration: .6s !important;
}
let html = document.querySelector("html")
document.querySelector(".nav__burger-btn").onclick = function(){
html.classList.toggle("unscroll")
}
.unscroll{
overflow:hidden;
}
<!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="bg"></div>
</body>
<style>
.bg{
background: url("https://centr-plyazhnogo-voleybolu.netlify.app/photo-header.jpg");
width: 300px;
height: 300px;
background-size: cover;
}
</style>
<script>
let preview = document.querySelector(".bg")
preview.onclick = function(){
preview.style.backgroundImage = "url('https://centr-plyazhnogo-voleybolu.netlify.app/img11.jpg')"
}
</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>
</body>
<script>
let array = [2,5,24,76,188,64,97,4,13, -9]
let min = array[0];
for(let i = 0; i < array.length; i++){
if(array[i] < min){
min = array[i]
}
}
console.log("Min: " + min);
let array2 = [2,5,24,76,100088,64,97,4,10, -9]
let max = array2[0];
for(let i = 0; i < array2.length; i++){
if(array2[i] > max){
max = array2[i]
}
}
console.log("Max: " + max);
</script>
</html>