{"id":21626445,"url":"https://github.com/qodesmith/background-image-gallery","last_synced_at":"2025-04-11T12:46:21.034Z","repository":{"id":32815712,"uuid":"36408532","full_name":"qodesmith/background-image-gallery","owner":"qodesmith","description":"Fading background image gallery using JavaScript and CSS - optional random order on each page load.","archived":false,"fork":false,"pushed_at":"2018-09-11T13:34:37.000Z","size":82,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T09:03:34.197Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qodesmith.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}},"created_at":"2015-05-28T02:07:00.000Z","updated_at":"2023-01-23T19:47:08.000Z","dependencies_parsed_at":"2022-09-12T14:01:12.477Z","dependency_job_id":null,"html_url":"https://github.com/qodesmith/background-image-gallery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qodesmith%2Fbackground-image-gallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qodesmith%2Fbackground-image-gallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qodesmith%2Fbackground-image-gallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qodesmith%2Fbackground-image-gallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qodesmith","download_url":"https://codeload.github.com/qodesmith/background-image-gallery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402545,"owners_count":21097331,"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-25T01:13:23.469Z","updated_at":"2025-04-11T12:46:21.003Z","avatar_url":"https://github.com/qodesmith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Background Image Gallery\n\nFullscreen fading image goodness! This is a tiny (963 bytes gzipped!) JavaScript library for creating a fullscreen background image gallery where the images fade from one to the other. Made with nothing but *love* and *vanilla JavaScript* (redundant, I know).\n\n\n## Installation\n\n### Manually\n\nSimply include `styles.css` in the `\u003chead\u003e`...\n\n```html\n\u003chead\u003e\n  ...\n  \u003clink rel=\"stylesheet\" href=\"styles.css\"\u003e\n  \u003c!-- Via Unpkg CDN --\u003e\n  \u003c!-- \u003clink rel=\"stylesheet\" href=\"https://unpkg.com/background-image-gallery/dist/styles.css\"\u003e --\u003e\n\u003c/head\u003e\n```\n\nand include `big.js` just above your closing `\u003c/body\u003e` tag...\n\n```html\n\u003cbody\u003e\n  ...\n  \u003cscript src=\"big.js\"\u003e\u003c/script\u003e\n  \u003c!-- Via Unpkg CDN --\u003e\n  \u003c!-- \u003cscript src=\"https://unpkg.com/background-image-gallery/dist/big.js\"\u003e\u003c/script\u003e --\u003e\n\u003c/body\u003e\n```\n\n### Via NPM\n\n```\nnpm install background-image-gallery\n```\n\n\n## What It's Doing\n\nIs this magic?! All code is magic. The gallery simply creates a new `\u003cdiv\u003e` for each photo you supply, appends it to `document.body`, and applies some necessary inline CSS. A class will be toggled on each div to show/hide the images. The included CSS file takes care of the rest (such as full-screen coverage, width \u0026 heights, etc.).\n\n\n## Usage\n\n```javascript\n// Store in a variable to stop the gallery later on (see below).\nconst gallery = big({\n  photos: [{ image: 'photo1.jpg'}, { image: 'http://example.com/photo2.png'}],\n  interval: 5000,\n  fade: 3000,\n  random: true\n})\n```\n\n### Options\n\nThe gallery takes an `{ options }` object as its only argument:\n\n#### photos\n\nSupply an array of objects that take the shape of `{ image: \u003cfile/location\u003e.png }`.\n\nThe image locations can be local to wherever you're running the code or out there on the interwebs:\n\n```javascript\n[\n  { image: './location/to/local/image.png' },\n  { image: 'https://i.imgur.com/M0IIqJ2.jpg' }\n]\n```\n\nWhy isn't it an array of just file locations, you ask? Because I plan on adding other features that will require objects to be used instead... that's why.\n\n#### interval\n\nHow long do you want each photo to show before fading into the next? Tell me in milliseconds.\n\n#### fade\n\nHow fast do you want one image to fade into the next? Again, milliseconds please.\n\n#### random\n\nIf you provide `true`, your array will be randomized and everyone will think you're awesome.\n\n### Stopping The Gallery / Cleanup\n\nOk, so you've got the gallery running on the page but enough's enough. How do we stop this thing? And who's gonna put away all those `\u003cdiv\u003e`'s this thing took out? Simple. The `big` function returns an object with 2 simple methods - `stop` and `clean`:\n\n```javascript\nconst gallery = big({ ... })\n\n/* Time passes by... */\n\n// The gallery stops but the images are still in the DOM.\ngallery.stop()\n\n// The gallery stops and the images are removed from the DOM.\ngallery.clean()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqodesmith%2Fbackground-image-gallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqodesmith%2Fbackground-image-gallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqodesmith%2Fbackground-image-gallery/lists"}