TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: The smallest and most narcissistic image lazyloading JavaScript library

10 pointsby l1am0over 5 years ago

4 comments

l1am0over 5 years ago
IMO lazy loading the images on your websites is a good idea in 99% of the cases. As all the other lazy load libraries where way to heavy for use case I build lazy-simon.js.<p>It is build with JavaScript intersection observers. To keep it below 500 byte it currently only works with img tags, but I may adapt it for more HTML tags if that is useful.<p>I do not plan to add a lot of config options, as there are nice highly configurable lazy loading libraries out there. Mine should just be a script include and you are done :D
alexzaover 5 years ago
Some browsers like chrome support this functionality natively by setting the image attribute loading=&quot;lazy&quot; (<a href="https:&#x2F;&#x2F;web.dev&#x2F;native-lazy-loading&#x2F;" rel="nofollow">https:&#x2F;&#x2F;web.dev&#x2F;native-lazy-loading&#x2F;</a>) You could improve your library by adding a check wether the browser supports it natively, if yes use the loading attribute, if no use the visibility observer
评论 #21835573 未加载
phillipseamoreover 5 years ago
Use svg instead of that PNG and dataset not set&#x2F;getattribute and you are down to 400
评论 #21830228 未加载
评论 #21829968 未加载
adawg_4over 5 years ago
This is beautiful tbh, will use in projects.