100 lines
3.8 KiB
HTML
100 lines
3.8 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head lang="en">
|
||
|
<meta charset="UTF-8" />
|
||
|
<title>
|
||
|
Lazy iframes - Lazyload demos
|
||
|
</title>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
<style>
|
||
|
iframe {
|
||
|
width: 600px;
|
||
|
height: 300px;
|
||
|
display: block;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<h1>Lazy iframes demo</h1>
|
||
|
<div id="results1" class="results">
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<p>Scroll down to see lazily loaded iframes</p>
|
||
|
<iframe class="lazy" data-src="iframes/i01.html" frameborder="0"></iframe>
|
||
|
<iframe class="lazy" data-src="iframes/i02.html" frameborder="0"></iframe>
|
||
|
<iframe class="lazy" data-src="iframes/i03.html" frameborder="0"></iframe>
|
||
|
</div>
|
||
|
<script src="../dist/lazyload.min.js"></script>
|
||
|
<script>
|
||
|
(function () {
|
||
|
function logElementEvent(eventName, element) {
|
||
|
console.log(Date.now(), eventName, element.getAttribute("data-src"));
|
||
|
}
|
||
|
|
||
|
var callback_enter = function (element) {
|
||
|
logElementEvent("🔑 ENTERED", element);
|
||
|
};
|
||
|
var callback_exit = function (element) {
|
||
|
logElementEvent("🚪 EXITED", element);
|
||
|
};
|
||
|
var callback_loading = function (element) {
|
||
|
logElementEvent("⌚ LOADING", element);
|
||
|
};
|
||
|
var callback_loaded = function (element) {
|
||
|
logElementEvent("👍 LOADED", element);
|
||
|
};
|
||
|
var callback_error = function (element) {
|
||
|
logElementEvent("💀 ERROR", element);
|
||
|
element.src =
|
||
|
"https://via.placeholder.com/440x560/?text=Error+Placeholder";
|
||
|
};
|
||
|
var callback_finish = function () {
|
||
|
logElementEvent("✔️ FINISHED", document.documentElement);
|
||
|
};
|
||
|
var callback_cancel = function (element) {
|
||
|
logElementEvent("🔥 CANCEL", element);
|
||
|
};
|
||
|
|
||
|
ll = new LazyLoad({
|
||
|
// Assign the callbacks defined above
|
||
|
callback_enter: callback_enter,
|
||
|
callback_exit: callback_exit,
|
||
|
callback_cancel: callback_cancel,
|
||
|
callback_loading: callback_loading,
|
||
|
callback_loaded: callback_loaded,
|
||
|
callback_error: callback_error,
|
||
|
callback_finish: callback_finish
|
||
|
});
|
||
|
})();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|