-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.ejs
51 lines (40 loc) · 1.7 KB
/
template.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<base href = "<%= htmlWebpackPlugin.options.baseUrl %>" />
<title>Flicker Fun</title>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script defer>
console.log('adding event listenr');
document.addEventListener("DOMContentLoaded", function() {
let lazyloadThrottleTimeout;
function lazyload () {
let lazyloadImages = $("img.lazy");
if(lazyloadThrottleTimeout) {
clearTimeout(lazyloadThrottleTimeout);
}
lazyloadThrottleTimeout = setTimeout(function() {
let scrollTop = window.pageYOffset;
lazyloadImages.each(function(i, img) {
if(img.offsetTop < (window.innerHeight + scrollTop)) {
img.src = img.dataset.src;
img.classList.remove('lazy');
}
});
}, 20);
}
$(window).scroll(lazyload);
$(window).resize(lazyload);
});
</script>
</head>
<body>
<div id="root"></div>
<% for (key in htmlWebpackPlugin.files.js) { %><script type="text/javascript" src="/<%= htmlWebpackPlugin.files.js[key] %>/"></script><% } %>
<a style="display: none" href="https://smallseotools.com/visitor-hit-counter/" target="_blank" title="smallseotools counter for traffic" rel="nofollow noopener"><img src="https://smallseotools.com/counterDisplay?code=d907e5aa552fbc59c27cc6cf1f25dfb9&style=0001&pad=5&type=ip&initCount=1" alt="smallseotools counter for traffic" border="0"></a>
</body>
</html>