{"id":21528642,"url":"https://github.com/ruskydev/lazyloader","last_synced_at":"2025-03-17T18:45:45.945Z","repository":{"id":143629839,"uuid":"616409538","full_name":"RuskyDev/LazyLoader","owner":"RuskyDev","description":"LazyLoader is a lightweight and easy-to-use JavaScript library for lazy loading images and other media content on website.","archived":false,"fork":false,"pushed_at":"2023-05-08T17:56:10.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T06:11:23.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RuskyDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T10:35:48.000Z","updated_at":"2023-04-17T00:13:07.000Z","dependencies_parsed_at":"2023-07-13T17:31:34.528Z","dependency_job_id":null,"html_url":"https://github.com/RuskyDev/LazyLoader","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RuskyDev%2FLazyLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RuskyDev%2FLazyLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RuskyDev%2FLazyLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RuskyDev%2FLazyLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RuskyDev","download_url":"https://codeload.github.com/RuskyDev/LazyLoader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244092138,"owners_count":20396735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:53:56.843Z","updated_at":"2025-03-17T18:45:45.935Z","avatar_url":"https://github.com/RuskyDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LazyLoader\nLazyLoader is a lightweight JavaScript library for lazy loading images on a web page. It allows you to delay the loading of images until they are needed, reducing initial page load times and saving bandwidth.\n# Installation\nTo use LazyLoader, simply include the **lazyloader.js** file in your HTML page like this:\n```html\n\u003cscript src=\"lazyloader.js\"\u003e\u003c/script\u003e\n```\nor\n```html\n\u003cscript src=\"https://raw.githubusercontent.com/RuskyDev/LazyLoader/main/lazyloader.js\"\u003e\u003c/script\u003e\n```\n# Usage\nTo use LazyLoader, select the images you want to lazy load using a query selector, and then create a new instance of the **LazyLoader** class. You can pass in an optional options object to customize the behavior of the library. Here's an example:\n\n```javascript\nconst images = document.querySelectorAll('img[data-src]');\nconst lazyLoader = new LazyLoader(images, {\n  rootMargin: '50px',\n  threshold: 0.5,\n  placeholder: 'placeholder.jpg',\n  blur: true,\n  blurAmount: 10\n});\n\nlazyLoader.load();\n```\nIn this example, we're selecting all images with a **data-src** attribute and passing them to the **LazyLoader** constructor. We're also specifying an options object with the **rootMargin** and **threshold** options used to determine when the images should be loaded. Additionally, we're using the **placeholder**, **blur**, and **blurAmount** options to enhance the user experience.\n\n# Options\n\nThe following options are available:\n\n- **rootMargin**: A string representing the root margin for the intersection observer. Defaults to '**0px**'.\n- **threshold**: A number between 0 and 1 representing the intersection ratio needed for an image to be considered visible. Defaults to **0**.\n- **placeholder**: A string representing the URL of the placeholder image to show while the real image is loading. Defaults to an empty string.\n- **blur**: A boolean indicating whether to show a blurred version of the image while it's loading. Defaults to **false**.\n- **blurAmount**: A number representing the amount of blur to apply to the image while it's loading. Defaults to **5**.\n\n# Contributing\n\nIf you find a bug or have a feature request, please submit an issue on the [**GitHub repository.**](https://github.com/RuskyDev/LazyLoader/issues). Contributions are also welcome; feel free to fork the repository and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruskydev%2Flazyloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruskydev%2Flazyloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruskydev%2Flazyloader/lists"}