{"id":13565050,"url":"https://github.com/Q42/delighters","last_synced_at":"2025-04-03T22:30:30.224Z","repository":{"id":50319432,"uuid":"123240984","full_name":"Q42/delighters","owner":"Q42","description":"Add CSS animations to delight users as they scroll down.","archived":false,"fork":false,"pushed_at":"2019-04-28T09:39:38.000Z","size":15,"stargazers_count":751,"open_issues_count":2,"forks_count":60,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-27T12:43:07.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://q42.github.io/delighters/","language":"HTML","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/Q42.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":"2018-02-28T06:35:12.000Z","updated_at":"2025-03-09T13:29:28.000Z","dependencies_parsed_at":"2022-09-24T12:20:20.419Z","dependency_job_id":null,"html_url":"https://github.com/Q42/delighters","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/Q42%2Fdelighters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2Fdelighters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2Fdelighters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2Fdelighters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Q42","download_url":"https://codeload.github.com/Q42/delighters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247089679,"owners_count":20881818,"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-08-01T13:01:39.898Z","updated_at":"2025-04-03T22:30:29.902Z","avatar_url":"https://github.com/Q42.png","language":"HTML","funding_links":[],"categories":["HTML","目录"],"sub_categories":[],"readme":"Delighters\n==========\n\nAdd CSS animations to delight users as they scroll down.\nA tiny javascript library by [Q42](https://q42.com).\nIt was written by [Martin Kool](https://twitter.com/mrtnkl).\n\nSee the demo [here](https://q42.github.io/delighters)\n\nUsage\n---\n1. Include the script.\n``` js\n\u003cscript type=\"text/javascript\" src=\"delighters.js\"\u003e\n```\n2. Add delighter attributes\n```\n\u003cdiv class=\"foo\" data-delighter\u003e\n```\n3. Style the delighter (or its children) using built-in classes `.started` and `.ended`\n\nWhen the library loads, each [data-delighter] gets the .delighter class.\n```\n.foo.delighter {\n  transition: all .3s ease-out;\n  transform: translateX(-100%);\n  opacity: 0;\n}\n```\nThe `.started` class is set when the top of [data-delighter] element is at 0.75 of the viewport (where 0 is top and 1 is bottom).\n```\n.foo.delighter.started {\n  transform: none;\n  opacity: 1;\n}\n```\nAn extra `.ended` class is set when the bottom of [data-delighter] element is at 0.75 of the viewport (where 0 is top and 1 is bottom).\n```\n.foo.delighter.started.ended {\n  border: solid red 10px;\n}\n```\nHow it works\n---\n* Delighters.js toggles classes when you scroll down. You do the rest!\n* Each delighter gets a `.started` class when its *top* raises above 75% of the browser's viewport height\n* When the *bottom* of the delighter is at 75%, an extra class `.ended` is added\n* You can change any of these like so: `data-delighter=\"start:0.5;end:0.95;`\n* Remember: 0 = top, 1 = bottom\n* Values outside the viewport are allowed, such as `start:1.2;end:-0.3`\n\nDebugging\n---\n* Set the `data-delighter=\"debug\"` flag to enable debugging for that delighter\n* This will give the delighter a red outline\n* Also, a dotted red hint line is shown when the delighter is within the viewport\n* The hint line is positioned at the defined start, which by default is `0.75`\n* The line is removed when the bottom of the delighter is above the end position, by default also `0.75`\n\nCustomizing\n---\nBy default, delighters.js intializes automatically when the DOM is ready, and with the following configuration:\n```\n  options = {\n    attribute:  'data-delighter',\n    classNames: ['delighter', 'started', 'ended'],\n    start:      0.75, // default start threshold\n    end:        0.75, // default end threshold\n    autoInit:   true  // initialize when DOMContentLoaded\n  }\n ```\nYou can customize any or all of the above properties using:\n```\n  Delighters.config({    \n    // set the default start threshold at the bottom\n    start: 1,\n    // let's call Delighters.init() manually later\n    autoInit: false \n    // ... etc ...\n  })\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQ42%2Fdelighters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQ42%2Fdelighters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQ42%2Fdelighters/lists"}