1document.documentElement.style.setProperty('--scrollbar-width', (window.innerWidth - document.documentElement.clientWidth) + 'px') 2 3document.addEventListener('click', event => { 4 const elem = event.target 5 if (elem.closest('.site-header__open-nav')) { 6 document.body.classList.add('show-nav') 7 } 8 if (elem.closest('.site-header__close-nav')) { 9 document.body.classList.remove('show-nav') 10 } 11}) 12 13const parallax = document.querySelectorAll('.parallax') 14const counter = document.querySelectorAll('[data-count]') 15const on_scroll = document.querySelectorAll('[data-on-scroll]') 16const circles = document.querySelectorAll('.circles-trigger') 17 18 19function sticky_animation () { 20 21 jQuery('.sticky-animation').each(function () { 22 23 let position = 0; 24 25 jQuery(this).find('.sticky-animation__left > div').each(function () { 26 27 if (jQuery(this).offset().top <= jQuery(window).scrollTop() + (jQuery(window).height() / 2)) { 28 position = jQuery(this).index(); 29 } 30 31 }); 32 33 jQuery('body').removeClass('circles-0'); 34 jQuery('body').removeClass('circles-1'); 35 jQuery('body').removeClass('circles-2'); 36 jQuery('body').removeClass('circles-3'); 37 38 jQuery('body').addClass('circles-' + position); 39 40 console.log(position); 41 42 }); 43 44 if (jQuery(window).width() <= 1023) { 45 jQuery('body').removeClass('circles-0'); 46 jQuery('body').removeClass('circles-1'); 47 jQuery('body').removeClass('circles-2'); 48 jQuery('body').removeClass('circles-3'); 49 } 50 51} 52 53sticky_animation(); 54 55window.addEventListener('scroll', () => { 56 57 const windowHeight = window.innerHeight 58 59 parallax.forEach(elem => { 60 const obj = elem.getBoundingClientRect() 61 const ratio = (obj.top - (windowHeight - obj.height) / 2) * -.010 62 elem.style.transform = `translateY(${ratio}rem)` 63 }) 64 65 counter.forEach(elem => { 66 const scroll = elem.getBoundingClientRect().top - windowHeight 67 if (0 > scroll && !elem.dataset.play) { 68 const count = elem.dataset.count 69 for (let index = 0; index <= count; index++) { 70 setTimeout(() => elem.innerHTML = index, (2000 / count) * index) 71 } 72 elem.dataset.play = true 73 } 74 }) 75 76 on_scroll.forEach(elem => { 77 const scroll = elem.getBoundingClientRect().top - windowHeight 78 if (0 > scroll) elem.classList.add('active') 79 else elem.classList.remove('active') 80 }) 81 82 circles.forEach(elem => { 83 const scroll = elem.getBoundingClientRect().top 84 if (0 > scroll) document.body.classList.add(`circles-${elem.dataset.state}`) 85 else document.body.classList.remove(`circles-${elem.dataset.state}`) 86 }) 87 88 sticky_animation(); 89 90}, false) 91 92 93 94// BOTON SUBIR ARRIBA 95//invocamos al objeto (window) y a su método (scroll), solo se ejecutara si el usuario hace scroll en la página 96$(window).scroll(function(){ 97 if($(this).scrollTop() > 300){ //condición a cumplirse cuando el usuario aya bajado 301px a más. 98 $("#js_up").slideDown(300); //se muestra el botón en 300 mili segundos 99 }else{ // si no 100 $("#js_up").slideUp(300); //se oculta el botón en 300 mili segundos 101 } 102}); 103 104//creamos una función accediendo a la etiqueta i en su evento click 105$("#js_up i").on('click', function (e) { 106 e.preventDefault(); //evita que se ejecute el tag ancla (<a href="#">valor</a>). 107 $("body,html").animate({ // aplicamos la función animate a los tags body y html 108 scrollTop: 0 //al colocar el valor 0 a scrollTop me volverá a la parte inicial de la página 109 },700); //el valor 700 indica que lo ara en 700 mili segundos 110 return false; //rompe el bucle 111});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.