New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

open-loadr

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

open-loadr

Loadr is an efficient solution for seamlessly loading large images in HTML, with a minified size of under 1 KB.

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
0
Weekly downloads
 
Created
Source

Logo Banner

Published on npm

Loadr is an efficient solution for seamlessly loading large images in HTML, with a minified size of under 1 KB.

Demo

Installation

CDN

Import Loadr using CDN.

index.html

<script src="https://cdn.jsdelivr.net/npm/open-loadr/loadr.min.js"></script>
🚧 Specific Version
<script src="https://cdn.jsdelivr.net/npm/open-loadr@latest/loadr.min.js"></script>

Usage

Add the hr-src to the HTML <img> element, This will be your high-res image. In the src attribute is the low-res version of your image. Loadr will load the high-res image in the background then update the src with its URL, Replacing the low-res image.

index.html

<img hr-src="https://open-loadr.github.io/loadr/images/the_starry_night/high_res.jpg" src="https://open-loadr.github.io/loadr/images/the_starry_night/low_res.png">

Call Loadr in your Javascript. That's it 🎉.

index.html

<script>
  new Loadr();
</script>

Check out the Demo on Codepen.

Extra step

Lets add some styling to the <img> element.

style.css

img {
  height: 300px;
  width: 300px;
  object-fit: cover;
  border-radius: 15px;
  overflow: hidden;
}

Customization

Loadr comes with variables that can be easily customized.

index.html

<script>
  new Loadr({
    async: false,
    cache: true,
    delay: '750'
  });
</script>

Check out the Customization Demo on Codepen.

Licensed under the MIT License, Copyright © 2024-present open-loadr.

See LICENSE for more information.

Keywords

FAQs

Package last updated on 02 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc