{"id":17036006,"url":"https://github.com/phucbm/bg-prlx","last_synced_at":"2026-04-16T13:33:29.174Z","repository":{"id":65522971,"uuid":"487000549","full_name":"phucbm/bg-prlx","owner":"phucbm","description":"No-dependency npm package to create parallax effect for images.","archived":false,"fork":false,"pushed_at":"2022-05-01T05:13:55.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T10:22:36.353Z","etag":null,"topics":["npm-package","parallax"],"latest_commit_sha":null,"homepage":"https://phucbm.github.io/bg-prlx","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phucbm.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}},"created_at":"2022-04-29T14:23:12.000Z","updated_at":"2022-05-02T03:35:19.000Z","dependencies_parsed_at":"2023-01-27T06:01:39.066Z","dependency_job_id":null,"html_url":"https://github.com/phucbm/bg-prlx","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/phucbm%2Fbg-prlx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fbg-prlx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fbg-prlx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fbg-prlx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phucbm","download_url":"https://codeload.github.com/phucbm/bg-prlx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245031345,"owners_count":20549913,"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":["npm-package","parallax"],"created_at":"2024-10-14T08:48:55.528Z","updated_at":"2026-04-16T13:33:29.132Z","avatar_url":"https://github.com/phucbm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bg-prlx\n\n[![release](https://badgen.net/github/release/phucbm/bg-prlx/?cache=600)](https://github.com/phucbm/bg-prlx/releases/latest)\n[![license](https://badgen.net/github/license/phucbm/bg-prlx/)](https://github.com/phucbm/bg-prlx/blob/main/LICENSE)\n\n\u003e Create parallax effect for inline `background-image` or `object-fit:cover`.\n\n## Install\n\n```sh\nnpm i bg-prlx\n```\n\n## Usage\n\nSimply add attribute `data-parallax` to your HTML.\n\n### Setup HTML\n\nWith inline `background-image`:\n\n```html\n\n\u003cdiv data-parallax\n     style=\"background-image:url(https://picsum.photos/1920/1280); background-size:cover; aspect-ratio:1920/800; width:100%;\"\u003e\n    \u003c!-- your extra content here --\u003e\n\u003c/div\u003e\n```\n\nOr with `\u003cimg\u003e`:\n\n```html\n\n\u003cdiv data-parallax\u003e\n    \u003cimg src=\"https://picsum.photos/1920/1280\" alt=\"Photo\" style=\"object-fit:cover; aspect-ratio:1920/800; width:100%;\"\u003e\n\u003c/div\u003e\n```\n\n\u003e Note: In order to have parallax effect, the block that contains the image must have a smaller height\n\u003e than the real image's height. In the example above, the image size is 1920x1280, while the block size has ratio of 1920x800.\n\n### Run script\n\n```js\nimport backgroundParallax from \"./index.js\";\n\nbackgroundParallax();\n```\n\n## API\n\n### backgroundParallax(elements?)\n\n#### elements\n\nType: `DOM element`\n\nDefault value is `document.querySelectorAll(\"[data-parallax]:not(.parallax-enabled)\")`.\n\n## License\n\n[MIT License](https://github.com/phucbm/bg-prlx/blob/main/LICENSE)\n\nCopyright (c) 2022 Minh-Phuc Bui\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Fbg-prlx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphucbm%2Fbg-prlx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Fbg-prlx/lists"}