web-assets/lazyload/v17/demos/picture_media.html

892 lines
28 KiB
HTML
Raw Permalink Normal View History

2023-12-30 22:34:25 +01:00
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" />
<title>
Picture with media attribute in source tags - Lazyload demos
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
ul,
li {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
min-height: 280px;
}
a,
img {
display: block;
}
img {
border: 0;
width: 220px;
height: 280px;
}
@media (min-width: 500px) {
img {
width: 330px;
height: 420px;
}
}
img:not([src]):not([srcset]) {
visibility: hidden;
}
</style>
</head>
<body>
<h1>Picture with media attribute in source tags demo</h1>
<div id="results1" class="results">
<ul>
<li>
<picture>
<source
media="(min-width: 500px)"
srcset="
https://via.placeholder.com/330x420?text=01_330w 1x,
https://via.placeholder.com/660x840?text=01_660w 2x
"
/>
<img
alt="Stivaletti"
src="https://via.placeholder.com/220x280?text=01_220w"
srcset="
https://via.placeholder.com/220x280?text=01_220w 1x,
https://via.placeholder.com/440x560?text=01_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
srcset="
https://via.placeholder.com/330x420?text=02_330w 1x,
https://via.placeholder.com/660x840?text=02_660w 2x
"
/>
<img
alt="Open toe"
src="https://via.placeholder.com/220x280?text=02_220w"
srcset="
https://via.placeholder.com/220x280?text=02_220w 1x,
https://via.placeholder.com/440x560?text=02_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
srcset="
https://via.placeholder.com/330x420?text=03_330w 1x,
https://via.placeholder.com/660x840?text=03_660w 2x
"
/>
<img
alt="Sneakers &amp; Tennis"
src="https://via.placeholder.com/220x280?text=03_220w"
srcset="
https://via.placeholder.com/220x280?text=03_220w 1x,
https://via.placeholder.com/440x560?text=03_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
srcset="
https://via.placeholder.com/330x420?text=04_330w 1x,
https://via.placeholder.com/660x840?text=04_660w 2x
"
/>
<img
alt="Sneakers &amp; Tennis shoes basse"
src="https://via.placeholder.com/220x280?text=04_220w"
srcset="
https://via.placeholder.com/220x280?text=04_220w 1x,
https://via.placeholder.com/440x560?text=04_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=05_330w 1x,
https://via.placeholder.com/660x840?text=05_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes alte"
data-src="https://via.placeholder.com/220x280?text=05_220w"
data-srcset="
https://via.placeholder.com/220x280?text=05_220w 1x,
https://via.placeholder.com/440x560?text=05_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=06_330w 1x,
https://via.placeholder.com/660x840?text=06_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes alte"
data-src="https://via.placeholder.com/220x280?text=06_220w"
data-srcset="
https://via.placeholder.com/220x280?text=06_220w 1x,
https://via.placeholder.com/440x560?text=06_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=07_330w 1x,
https://via.placeholder.com/660x840?text=07_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes basse"
data-src="https://via.placeholder.com/220x280?text=07_220w"
data-srcset="
https://via.placeholder.com/220x280?text=07_220w 1x,
https://via.placeholder.com/440x560?text=07_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=08_330w 1x,
https://via.placeholder.com/660x840?text=08_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes basse"
data-src="https://via.placeholder.com/220x280?text=08_220w"
data-srcset="
https://via.placeholder.com/220x280?text=08_220w 1x,
https://via.placeholder.com/440x560?text=08_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=09_330w 1x,
https://via.placeholder.com/660x840?text=09_660w 2x
"
/>
<img
class="lazy"
alt="Stivali"
data-src="https://via.placeholder.com/220x280?text=09_220w"
data-srcset="
https://via.placeholder.com/220x280?text=09_220w 1x,
https://via.placeholder.com/440x560?text=09_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=10_330w 1x,
https://via.placeholder.com/660x840?text=10_660w 2x
"
/>
<img
class="lazy"
alt="Stivali"
data-src="https://via.placeholder.com/220x280?text=10_220w"
data-srcset="
https://via.placeholder.com/220x280?text=10_220w 1x,
https://via.placeholder.com/440x560?text=10_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=11_330w 1x,
https://via.placeholder.com/660x840?text=11_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=11_220w"
data-srcset="
https://via.placeholder.com/220x280?text=11_220w 1x,
https://via.placeholder.com/440x560?text=11_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=12_330w 1x,
https://via.placeholder.com/660x840?text=12_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=12_220w"
data-srcset="
https://via.placeholder.com/220x280?text=12_220w 1x,
https://via.placeholder.com/440x560?text=12_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=13_330w 1x,
https://via.placeholder.com/660x840?text=13_660w 2x
"
/>
<img
class="lazy"
alt="Stivali"
data-src="https://via.placeholder.com/220x280?text=13_220w"
data-srcset="
https://via.placeholder.com/220x280?text=13_220w 1x,
https://via.placeholder.com/440x560?text=13_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=14_330w 1x,
https://via.placeholder.com/660x840?text=14_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=14_220w"
data-srcset="
https://via.placeholder.com/220x280?text=14_220w 1x,
https://via.placeholder.com/440x560?text=14_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=15_330w 1x,
https://via.placeholder.com/660x840?text=15_660w 2x
"
/>
<img
class="lazy"
alt="Décolleté"
data-src="https://via.placeholder.com/220x280?text=15_220w"
data-srcset="
https://via.placeholder.com/220x280?text=15_220w 1x,
https://via.placeholder.com/440x560?text=15_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=16_330w 1x,
https://via.placeholder.com/660x840?text=16_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=16_220w"
data-srcset="
https://via.placeholder.com/220x280?text=16_220w 1x,
https://via.placeholder.com/440x560?text=16_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=17_330w 1x,
https://via.placeholder.com/660x840?text=17_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=17_220w"
data-srcset="
https://via.placeholder.com/220x280?text=17_220w 1x,
https://via.placeholder.com/440x560?text=17_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=18_330w 1x,
https://via.placeholder.com/660x840?text=18_660w 2x
"
/>
<img
class="lazy"
alt="Décolleté"
data-src="https://via.placeholder.com/220x280?text=18_220w"
data-srcset="
https://via.placeholder.com/220x280?text=18_220w 1x,
https://via.placeholder.com/440x560?text=18_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=19_330w 1x,
https://via.placeholder.com/660x840?text=19_660w 2x
"
/>
<img
class="lazy"
alt="Décolleté"
data-src="https://via.placeholder.com/220x280?text=19_220w"
data-srcset="
https://via.placeholder.com/220x280?text=19_220w 1x,
https://via.placeholder.com/440x560?text=19_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=20_330w 1x,
https://via.placeholder.com/660x840?text=20_660w 2x
"
/>
<img
class="lazy"
alt="Francesine"
data-src="https://via.placeholder.com/220x280?text=20_220w"
data-srcset="
https://via.placeholder.com/220x280?text=20_220w 1x,
https://via.placeholder.com/440x560?text=20_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=21_330w 1x,
https://via.placeholder.com/660x840?text=21_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=21_220w"
data-srcset="
https://via.placeholder.com/220x280?text=21_220w 1x,
https://via.placeholder.com/440x560?text=21_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=22_330w 1x,
https://via.placeholder.com/660x840?text=22_660w 2x
"
/>
<img
class="lazy"
alt="Décolleté"
data-src="https://via.placeholder.com/220x280?text=22_220w"
data-srcset="
https://via.placeholder.com/220x280?text=22_220w 1x,
https://via.placeholder.com/440x560?text=22_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=23_330w 1x,
https://via.placeholder.com/660x840?text=23_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=23_220w"
data-srcset="
https://via.placeholder.com/220x280?text=23_220w 1x,
https://via.placeholder.com/440x560?text=23_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=24_330w 1x,
https://via.placeholder.com/660x840?text=24_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=24_220w"
data-srcset="
https://via.placeholder.com/220x280?text=24_220w 1x,
https://via.placeholder.com/440x560?text=24_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=25_330w 1x,
https://via.placeholder.com/660x840?text=25_660w 2x
"
/>
<img
class="lazy"
alt="Stivali"
data-src="https://via.placeholder.com/220x280?text=25_220w"
data-srcset="
https://via.placeholder.com/220x280?text=25_220w 1x,
https://via.placeholder.com/440x560?text=25_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=26_330w 1x,
https://via.placeholder.com/660x840?text=26_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=26_220w"
data-srcset="
https://via.placeholder.com/220x280?text=26_220w 1x,
https://via.placeholder.com/440x560?text=26_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=27_330w 1x,
https://via.placeholder.com/660x840?text=27_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=27_220w"
data-srcset="
https://via.placeholder.com/220x280?text=27_220w 1x,
https://via.placeholder.com/440x560?text=27_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=28_330w 1x,
https://via.placeholder.com/660x840?text=28_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=28_220w"
data-srcset="
https://via.placeholder.com/220x280?text=28_220w 1x,
https://via.placeholder.com/440x560?text=28_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=29_330w 1x,
https://via.placeholder.com/660x840?text=29_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=29_220w"
data-srcset="
https://via.placeholder.com/220x280?text=29_220w 1x,
https://via.placeholder.com/440x560?text=29_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=30_330w 1x,
https://via.placeholder.com/660x840?text=30_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=30_220w"
data-srcset="
https://via.placeholder.com/220x280?text=30_220w 1x,
https://via.placeholder.com/440x560?text=30_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=31_330w 1x,
https://via.placeholder.com/660x840?text=31_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=31_220w"
data-srcset="
https://via.placeholder.com/220x280?text=31_220w 1x,
https://via.placeholder.com/440x560?text=31_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=32_330w 1x,
https://via.placeholder.com/660x840?text=32_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=32_220w"
data-srcset="
https://via.placeholder.com/220x280?text=32_220w 1x,
https://via.placeholder.com/440x560?text=32_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=33_330w 1x,
https://via.placeholder.com/660x840?text=33_660w 2x
"
/>
<img
class="lazy"
alt="Cuissardes"
data-src="https://via.placeholder.com/220x280?text=33_220w"
data-srcset="
https://via.placeholder.com/220x280?text=33_220w 1x,
https://via.placeholder.com/440x560?text=33_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=34_330w 1x,
https://via.placeholder.com/660x840?text=34_660w 2x
"
/>
<img
class="lazy"
alt="Décolleté"
data-src="https://via.placeholder.com/220x280?text=34_220w"
data-srcset="
https://via.placeholder.com/220x280?text=34_220w 1x,
https://via.placeholder.com/440x560?text=34_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=35_330w 1x,
https://via.placeholder.com/660x840?text=35_660w 2x
"
/>
<img
class="lazy"
alt="Stivaletti"
data-src="https://via.placeholder.com/220x280?text=35_220w"
data-srcset="
https://via.placeholder.com/220x280?text=35_220w 1x,
https://via.placeholder.com/440x560?text=35_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=36_330w 1x,
https://via.placeholder.com/660x840?text=36_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes basse"
data-src="https://via.placeholder.com/220x280?text=36_220w"
data-srcset="
https://via.placeholder.com/220x280?text=36_220w 1x,
https://via.placeholder.com/440x560?text=36_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=37_330w 1x,
https://via.placeholder.com/660x840?text=37_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=37_220w"
data-srcset="
https://via.placeholder.com/220x280?text=37_220w 1x,
https://via.placeholder.com/440x560?text=37_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=38_330w 1x,
https://via.placeholder.com/660x840?text=38_660w 2x
"
/>
<img
class="lazy"
alt="Sneakers &amp; Tennis shoes basse"
data-src="https://via.placeholder.com/220x280?text=38_220w"
data-srcset="
https://via.placeholder.com/220x280?text=38_220w 1x,
https://via.placeholder.com/440x560?text=38_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=39_330w 1x,
https://via.placeholder.com/660x840?text=39_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=39_220w"
data-srcset="
https://via.placeholder.com/220x280?text=39_220w 1x,
https://via.placeholder.com/440x560?text=39_440w 2x
"
/>
</picture>
</li>
<li>
<picture>
<source
media="(min-width: 500px)"
data-srcset="
https://via.placeholder.com/330x420?text=40_330w 1x,
https://via.placeholder.com/660x840?text=40_660w 2x
"
/>
<img
class="lazy"
alt="Mocassini"
data-src="https://via.placeholder.com/220x280?text=40_220w"
data-srcset="
https://via.placeholder.com/220x280?text=40_220w 1x,
https://via.placeholder.com/440x560?text=40_440w 2x
"
/>
</picture>
</li>
</ul>
</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_cancel = function (element) {
logElementEvent("🔥 CANCEL", element);
};
var callback_finish = function () {
logElementEvent("✔️ FINISHED", document.documentElement);
};
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>