This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elements = document.querySelectorAll("div"), | |
callback = (el) => { console.log(el); }; | |
// Spread operator | |
[...elements].forEach(callback); | |
// Array.from() | |
Array.from(elements).forEach(callback); | |
// for...of statement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<figure class="placeholder" data-large="{path to large image}"> | |
<img src="{path to small image}" class="img-small loaded" alt="{alt}" /> <!-- small image about 50px wide and height to match ratio; keep to less than 3k --> | |
<div style="padding-bottom: {image ratio}%;"></div> <!-- ratio is height-in-px/width-in-px * 100 --> | |
</figure> |