themes/docsy/layouts/users/baseof.html (52 lines of code) (raw):
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
</head>
<body class="td-{{ .Kind }}">
<header>
{{ partial "navbar.html" . }}
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<main class="" role="main">
{{ block "main" . }}{{ end }}
</main>
</div>
{{ partial "footer.html" . }}
</div>
{{ partial "event-popup.html" . }}
{{ partial "sidebar-skywalking.html" . }}
{{ partial "scripts.html" . }}
<script>
var imgs = $(".users-wrapper img");
var viewHeight = window.innerHeight || document.documentElement.clientHeight;
var num = 0;
lazyload()
window.addEventListener("scroll", throttle(lazyload, 400), false);
function lazyload() {
for (var i = num; i < imgs.length; i++) {
var img = imgs.eq(i)
if (viewHeight - imgs.get(i).getBoundingClientRect().top >= -100) {
img.attr('src', img.attr('data-src'))
num = i + 1;
}
}
}
function throttle(func, wait) {
var timeout;
return function () {
var context = this;
var args = arguments;
if (!timeout) {
timeout = setTimeout(function () {
timeout = null;
func.apply(context, args)
}, wait)
}
}
}
</script>
</body>
</html>