{"id":20915301,"url":"https://github.com/oguzhan18/easy-lazy","last_synced_at":"2025-08-07T23:05:17.640Z","repository":{"id":240805236,"uuid":"803443259","full_name":"oguzhan18/easy-lazy","owner":"oguzhan18","description":"LazyLoad is a lightweight JavaScript library for lazy loading images with various customization options. It improves performance by loading images only when they are about to enter the viewport.","archived":false,"fork":false,"pushed_at":"2024-05-20T20:34:01.000Z","size":282,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T10:43:58.941Z","etag":null,"topics":["image-lazyload","javascript","javascript-library","lazyload","lazyload-images","library","load-testing"],"latest_commit_sha":null,"homepage":"https://easy-lazy.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oguzhan18.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-20T18:25:23.000Z","updated_at":"2024-05-20T20:43:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"d157439a-ae79-4f85-94d1-d0a0b268096d","html_url":"https://github.com/oguzhan18/easy-lazy","commit_stats":null,"previous_names":["oguzhan18/easy-lazy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oguzhan18/easy-lazy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oguzhan18%2Feasy-lazy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oguzhan18%2Feasy-lazy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oguzhan18%2Feasy-lazy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oguzhan18%2Feasy-lazy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oguzhan18","download_url":"https://codeload.github.com/oguzhan18/easy-lazy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oguzhan18%2Feasy-lazy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269338065,"owners_count":24400180,"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","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["image-lazyload","javascript","javascript-library","lazyload","lazyload-images","library","load-testing"],"created_at":"2024-11-18T16:14:00.436Z","updated_at":"2025-08-07T23:05:17.617Z","avatar_url":"https://github.com/oguzhan18.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy Lazy Load Image\n\nLazyLoad is a lightweight JavaScript library for lazy loading images with various customization options. It improves\nperformance by loading images only when they are about to enter the viewport.\n\n## Installation\n\nYou can install LazyLoad using npm:\n\n```bash\nnpm install easy-lazy-load-image\n```\n\nor\n\n```html\n\n\u003cscript src=\"https://cdn.jsdelivr.net/npm//easy-lazyload-image@0.0.1/index.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nTo use LazyLoad, create a new instance of the class and pass the CSS selector of the container holding the images along\nwith any desired options.\n\n### Basic Example\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eLazyLoad Example\u003c/title\u003e\n    \u003cstyle\u003e\n        #image {\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n        }\n\n        ul {\n            list-style-type: none;\n        }\n\n        li {\n            width: 550px;\n            height: 310px;\n            margin: 10px;\n            align-items: center;\n            background-color: gray;\n            border: 1px solid black;\n        }\n\n        img {\n            width: 100%;\n        }\n\n    \u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cdiv id=\"image-container\"\u003e\n    \u003cimg data-src=\"image1.jpg\" alt=\"Image 1\"\u003e\n    \u003cimg data-src=\"image2.jpg\" alt=\"Image 2\"\u003e\n\u003c/div\u003e\n\n\u003cscript src=\"https://cdn.jsdelivr.net/npm//easy-lazyload-image@0.0.1/index.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    document.addEventListener('DOMContentLoaded', function () {\n        new LazyLoad('#image-container', {\n            threshold: 200,\n            animation: 'fade',\n            callback: (element) =\u003e console.log(`Loaded: ${element.src}`),\n            delay: 300,\n            placeholder: 'placeholder.jpg',\n            errorImage: 'error.jpg',\n            useIntersectionObserver: true,\n            responsive: true\n        });\n    });\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Options\n\n1. `selector`: The CSS selector to target elements for lazy loading. This is a required parameter.\n2. `threshold`: The distance in pixels from the viewport that triggers the loading of an image. The default value is\n    300.\n3. `root`: The element that is used as the viewport for checking visibility of the target elements. The default value is\n   the browser viewport.\n4. `callback`: A callback function to execute after each image is loaded. Default is `null`.\n5. `animation`: The type of animation to use when loading images. Default is `fade`.\n6. `animationDuration`: The duration of the animation in milliseconds. Default is `500`.\n7. `delay`: The delay in milliseconds before loading an image. Default is `500`.\n8. `placeholder`: The URL of the placeholder image to use while the target image is loading. Default is `null`.\n9. `errorPlaceholder`: The URL of the placeholder image to use if the target image fails to load. Default is `null`.\n10. `useIntersectionObserver`: A boolean value indicating whether to use the Intersection Observer API. Default\n    is `false`.\n11. `responsive`: Whether to support responsive images using `srcset` and sizes attributes. Default is `false`.\n\n## Methods\n\n### Constructor\n\nCreates an instance of LazyLoad.\n\n```javascript\nnew LazyLoad(selector, options);\n```\n* `selector` (string): The CSS selector to target elements for lazy loading.\n* `options` (object): An object containing customization options.\n### Example\n\n```javascript\nnew LazyLoad('#image-container', {\n    threshold: 200,\n    animation: 'fade',\n    callback: (element) =\u003e console.log(`Loaded: ${element.src}`),\n    delay: 300,\n    placeholder: 'placeholder.jpg',\n    errorImage: 'error.jpg',\n    useIntersectionObserver: true,\n    responsive: true\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foguzhan18%2Feasy-lazy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foguzhan18%2Feasy-lazy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foguzhan18%2Feasy-lazy/lists"}