{"id":21524881,"url":"https://github.com/degjs/scrollto","last_synced_at":"2025-04-09T23:11:03.623Z","repository":{"id":10510059,"uuid":"65943175","full_name":"DEGJS/scrollTo","owner":"DEGJS","description":"Animated scrolling to an element or position","archived":false,"fork":false,"pushed_at":"2023-01-04T14:54:05.000Z","size":1340,"stargazers_count":5,"open_issues_count":12,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-09T23:10:57.205Z","etag":null,"topics":["animation-css"],"latest_commit_sha":null,"homepage":"http://degjs.com/scrollTo","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/DEGJS.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-08-17T21:26:21.000Z","updated_at":"2022-10-16T14:28:40.000Z","dependencies_parsed_at":"2023-01-13T15:59:04.730Z","dependency_job_id":null,"html_url":"https://github.com/DEGJS/scrollTo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FscrollTo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FscrollTo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FscrollTo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FscrollTo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEGJS","download_url":"https://codeload.github.com/DEGJS/scrollTo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125606,"owners_count":21051770,"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-css"],"created_at":"2024-11-24T01:30:18.454Z","updated_at":"2025-04-09T23:11:03.606Z","avatar_url":"https://github.com/DEGJS.png","language":"JavaScript","readme":"# scrollTo\n![Run Tests](https://github.com/DEGJS/scrollTo/workflows/Run%20Tests/badge.svg)\n\nScrollTo is a module that will scroll to a specified element or position on a page with animated movement. It takes advantage of the native [window.requestAnimationFrame()](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) method to ensure smooth animation.\n\n**Please note** that several native scrolling methods exist with animation capabilities, including [Element.scrollTo()](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo), [Window.scrollTo()](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo), and [Element.scrollIntoView()](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView). If these native methods meet your needs, we recommend using them in favor of this module.\n\n## Demo\nYou can view a demo of scrollTo [here](http://degjs.github.io/scrollTo/).\n\n## Install\nScrollTo is an ES6 module. Consequently, you'll need an ES6 transpiler ([Babel](https://babeljs.io) is a nice one) as part of your Javascript workflow.\n\nIf you're already using NPM for your project, you can install scrollTo with the following command:\n\n```\n$ npm install @degjs/scroll-to\n```\n## Usage\n```js\nimport scrollTo from \"@degjs/scroll-to\";\n\n/* Scroll to an element with a 1-second, eased-in animation */\nlet destinationElement = document.querySelector('.some-element');\nscrollTo({\n    element: destinationElement,\n    duration: 1000,\n    easing: 'easeIn'\n});\n```\n\n## Parameters\n\n### options\nType: `Object`\n\n#### options.element\nType: `Element`   \nThe element to scroll to. This option or the `position` option is required.\n\n#### options.position\nType: `Number`   \nThe vertical position (in pixels) on the page to scroll to. This option or the `element` option is required.\n\n#### options.duration\nType: `Number` Default: `500`   \nThe duration (in milliseconds) of the scroll animation. This option is optional.\n\n#### options.easing\nType: `String` Default: `easeOut`   \nThe easing function for the animation. This option is optional. Valid values are:\n+ linear\n+ easeIn\n+ easeOut\n+ easeInOut\n\n## Browser Support\nScrollTo depends on the following browser APIs:\n+ [window.requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) (Note: scrollTo will still technically function if window.requestAnimationFrame is not supported, but the scrolling movement will be instantaneous with no animation)\n+ [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n\nTo support legacy browsers, you'll need to include polyfills for the above APIs.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fscrollto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegjs%2Fscrollto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fscrollto/lists"}