1function getParameterByName(name) { 2 name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 3 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 4 results = regex.exec(location.search); 5 return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 6} 7 8jQuery(document).ready(function($) { 9 10 /* ------------------------------------ 11 1. Lazy-load images (your new code) 12 -------------------------------------- */ 13 const lazyImages = document.querySelectorAll("img[data-src]"); 14 15 if ("IntersectionObserver" in window) { 16 17 const imgObserver = new IntersectionObserver((entries, obs) => { 18 entries.forEach(entry => { 19 if (entry.isIntersecting) { 20 const img = entry.target; 21 img.src = img.dataset.src; 22 img.removeAttribute("data-src"); 23 obs.unobserve(img); 24 } 25 }); 26 }); 27 28 lazyImages.forEach(img => imgObserver.observe(img)); 29 } else { 30 // Fallback (old browser) 31 lazyImages.forEach(img => { 32 img.src = img.dataset.src; 33 img.removeAttribute("data-src"); 34 }); 35 } 36 37 /* ------------------------------------ 38 2. Your existing code (unchanged) 39 -------------------------------------- */ 40 const nav = $('#nav'), body = $('body'); 41 $('#nav-toggle').click(function () { 42 var _this = $(this); 43 if (_this.hasClass('active')) { 44 _this.removeClass('active'); 45 nav.removeClass('active') 46 } 47 else { 48 _this.addClass('active'); 49 nav.addClass('active') 50 } 51 }) 52 53 function openPop(c) { 54 c.css('display', 'block'); 55 setTimeout(function () { 56 c.css('opacity', '1') 57 }, 17) 58 } 59 60 $('.toPop').click(function (event) { 61 event.preventDefault(); 62 var c = $('#' + $(this).attr('href')); 63 openPop(c) 64 }); 65 66 $('.closePop').click(function (event) { 67 event.preventDefault(); 68 var c = $('#' + $(this).attr('href')); 69 c.css('opacity', '0'); 70 setTimeout(function () { 71 c.css('display', 'none') 72 }, 717) 73 }); 74 75 function moveTo(target, duration) { 76 var start = window.pageYOffset, 77 opt = { 78 duration: 2000, 79 callback: function () { }, 80 easing: easeInOutQuad 81 }, 82 distance = target.getBoundingClientRect().top - 100, 83 84 timeStart, timeElapsed; 85 86 requestAnimationFrame(function (time) { 87 timeStart = time; 88 loop(time); 89 }); 90 91 function loop(time) { 92 timeElapsed = time - timeStart; 93 94 window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)); 95 if (timeElapsed < duration) { 96 requestAnimationFrame(loop); 97 } else 98 end(); 99 } 100 101 function end() { 102 window.scrollTo(0, start + distance); 103 if (typeof opt.callback === 'function'); 104 opt.callback(); 105 } 106 107 function easeInOutQuad(t, b, c, d) { 108 t /= d / 2; 109 if (t < 1) return c / 2 * t * t * t + b; 110 t -= 2; 111 return c / 2 * (t * t * t + 2) + b; 112 } 113 } 114 115 $('.scrollto').click(function (event) { 116 event.preventDefault(); 117 var target = document.getElementById($(this).attr('data-href')); 118 moveTo(target, 3000); 119 }) 120 if (getParameterByName('action') === 'register' || getParameterByName('sk') === 'success') { 121 moveTo(document.getElementById('register'), 2000); 122 } 123 if (getParameterByName('action') === 'privacy') { 124 openPop($('#privacypolicy')) 125 } 126 if (getParameterByName('action') === 'disclaimer') { 127 openPop($('#disclaimer')) 128 } 129 130 $('.popForm').click(function () { 131 $('#footerContant').toggleClass('active') 132 }) 133 134 function isTouchDevice() { 135 return (('ontouchstart' in window) || 136 (navigator.maxTouchPoints > 0) || 137 (navigator.msMaxTouchPoints > 0)); 138 } 139 if (isTouchDevice()) { 140 141 $('.heighJs').css('height', window.innerHeight - $('header').height() + 'px') 142 $('.heighPrjs').css('height', window.innerHeight - $('header').height() - 70 + 'px') 143 144 addEventListener('orientationchange', event => { 145 $('.heighJs').css('height', window.innerHeight - $('header').height() + 'px') 146 $('.heighPrjs').css('height', window.innerHeight - $('header').height() - 70 + 'px') 147 }); 148 } 149 150 const header = document.getElementById('header') 151 function checkHeader() { 152 if (landing.getBoundingClientRect().bottom > 0) { 153 154 if (header.classList.contains('bg')) 155 header.classList.remove('bg') 156 157 } 158 else if (!header.classList.contains('bg')) 159 header.classList.add('bg') 160 } 161 162 let lastScrollTop = 0; 163 let ticking = false; 164 165 document.addEventListener("scroll", (event) => { 166 if (!ticking) { 167 window.requestAnimationFrame(() => { 168 checkHeader() 169 ticking = false; 170 }); 171 ticking = true; 172 } 173 });
174 checkHeader() 175 176 window.addEventListener('load', () => { 177 const loader = document.getElementById('loader'); 178 if (loader) 179 loader.style.opacity = 0; 180 181 if (getParameterByName('link') === 'team') { 182 moveTo(document.getElementById('team'), 1) 183 } 184 185 setTimeout(function () { 186 if (loader) 187 loader.style.display = 'none'; 188 }, 500) 189 }); 190}); 191 192/* ------------------------------------ 193 Your existing toAnimate observer 194-------------------------------------- */ 195const lazyElements = document.querySelectorAll('.toAnimate'); 196 197const observer = new IntersectionObserver((entries) => { 198 entries.forEach((entry) => { 199 if (entry.intersectionRatio >= 0.5) { 200 const element = entry.target; 201 element.classList.add('animated'); 202 observer.unobserve(element); 203 } 204 }); 205}, { threshold: [0.5] }); 206 207lazyElements.forEach((element) => { 208 observer.observe(element); 209}); 210 211/* ------------------------------------ 212 Your existing on-load video trigger 213-------------------------------------- */ 214window.addEventListener('load', function () { 215 if (getParameterByName('action') === 'video') { 216 var t = document.getElementById('vimeo-btn') 217 console.log(t) 218 //t.click() 219 } 220});
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.