{"id":22194344,"url":"https://github.com/vigetlabs/ensure-animation","last_synced_at":"2025-07-26T23:32:04.322Z","repository":{"id":57225620,"uuid":"71476137","full_name":"vigetlabs/ensure-animation","owner":"vigetlabs","description":"Ensure animation runs until class loaded","archived":false,"fork":false,"pushed_at":"2017-01-11T23:29:45.000Z","size":103,"stargazers_count":76,"open_issues_count":0,"forks_count":3,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T21:49:18.194Z","etag":null,"topics":["animation","javascript","preloader"],"latest_commit_sha":null,"homepage":null,"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/vigetlabs.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":"2016-10-20T15:18:44.000Z","updated_at":"2022-04-07T17:53:20.000Z","dependencies_parsed_at":"2022-08-24T10:40:21.913Z","dependency_job_id":null,"html_url":"https://github.com/vigetlabs/ensure-animation","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigetlabs%2Fensure-animation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigetlabs%2Fensure-animation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigetlabs%2Fensure-animation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigetlabs%2Fensure-animation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vigetlabs","download_url":"https://codeload.github.com/vigetlabs/ensure-animation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227732302,"owners_count":17811370,"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":["animation","javascript","preloader"],"created_at":"2024-12-02T13:12:29.366Z","updated_at":"2024-12-02T13:12:30.179Z","avatar_url":"https://github.com/vigetlabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ensure Animation\nA simple JS module to ensure a CSS animation plays continuously through to the end animation frame.\n\n## [See the Demo](http://code.viget.com/ensure-animation)\n\n## Use Cases\nContinue playing loading animation until a:\n* Lazy loaded image is loaded\n* User has clicked on a notification\n* \"Load more\" ajax request has been completed\n* Chain multiple animations to fire sequentially\n\n## Install\n```bash\nnpm install ensure-animation --save\n```\n\n## Usage\nGiven the following markup:\n```html\n\u003cfigure\u003e\n  \u003cimg src=\"large-image.jpg\" class=\"hero lazyload\"\u003e\n  \u003cdiv class=\"preloader\" data-ensure-target=\".hero\" data-ensure-until=\".lazyloaded\" data-ensure-finish-class=\"fade-in\"\u003e\u003c/div\u003e\n\u003c/figure\u003e\n```\nImport EnsureAnimation for use in your JS:\n```js\nimport EnsureAnimation from 'ensure-animation'\nnew EnsureAnimation('.preloader')\n```\n\n## Get instances\n```js\nconst preloaders = new EnsureAnimation('.preloaders')\n```\n\n## Stop single instance\n```js\nconst preload = new EnsureAnimation('.preloader')[0]\npreload.finish()\n```\n\n## Restart the animation\n```js\npreload.restart()\n```\n\n## Stop all instances\n```js\nconst preloaders = new EnsureAnimation('.preloader')\npreloaders.each((preloader) =\u003e preloader.finish())\n```\n\n## Custom Options\nOptions can be passed directly to an instance using data attributes on the node itself, or by passing in an object of values.\n```html\n\u003cfigure\u003e\n  \u003cimg src=\"large-image.jpg\" class=\"hero lazyload\"\u003e\n  \u003cdiv data-ensure-target=\".hero\"\n       data-ensure-until=\".lazyloaded\"\n       data-ensure-finish-class=\"fade-in\"\n       class=\"preloader\"\u003e\u003c/div\u003e\n\u003c/figure\u003e\n```\nAnd\n```js\nconst preloaders = new EnsureAnimation('.preloader', {\n  // target to watch for class to be applied\n  target : '.hero-image'\n\n  // targets' class signaling animation should finish\n  until : 'has-been-loaded',\n\n  // target received this class upon finished animation,\n  finishClass : 'custom-finished-class'\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigetlabs%2Fensure-animation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvigetlabs%2Fensure-animation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigetlabs%2Fensure-animation/lists"}