{"_id":"@daveobriencouk/animated-scroll-to","_rev":"2-5a90afaaba6631d8ea4914369d40efb0","name":"@daveobriencouk/animated-scroll-to","description":"Simple, plain JavaScript animated window scroll","dist-tags":{"latest":"1.1.8"},"versions":{"1.1.8":{"name":"@daveobriencouk/animated-scroll-to","version":"1.1.8","description":"Simple, plain JavaScript animated window scroll","main":"animated-scroll-to.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Stanko/animated-scroll-to.git"},"keywords":["scroll","scrollTo"],"author":{"name":"Stanko"},"license":"MIT","bugs":{"url":"https://github.com/Stanko/animated-scroll-to/issues"},"homepage":"https://github.com/Stanko/animated-scroll-to#readme","devDependencies":{},"gitHead":"0227f51ea39293b8fba34594955637d3d012fda9","_id":"@daveobriencouk/animated-scroll-to@1.1.8","_shasum":"a58ec78923f8c16e58c3207192de3e41a9fc6506","_from":".","_npmVersion":"4.6.1","_nodeVersion":"7.8.0","_npmUser":{"name":"daveobriencouk","email":"me@daveobrien.co.uk"},"dist":{"shasum":"a58ec78923f8c16e58c3207192de3e41a9fc6506","tarball":"https://registry.npmjs.org/@daveobriencouk/animated-scroll-to/-/animated-scroll-to-1.1.8.tgz","integrity":"sha512-fFWH/vv4tPn3B1u9rWMhIgMMALiHle5nbWs2CqemRksJo1cc7Oen1v0CE73bU8tgCYvaE3r9l5ekpBStv6o5zA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAp74/vNR9hVdX60rk/f1ebU8YdDe9bINio1Y759GLrBAiEAyMdkWCNxhIHlCKXG1eHjhJ6W7qgJqiCJvV2cDhPnMpI="}]},"maintainers":[{"name":"daveobriencouk","email":"me@daveobrien.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/animated-scroll-to-1.1.8.tgz_1516011035793_0.8740730441641062"}}},"readme":"# animated-scroll-to\n\n[![npm version](https://img.shields.io/npm/v/animated-scroll-to.svg?style=flat-square)](https://www.npmjs.com/package/animated-scroll-to)\n[![npm downloads](https://img.shields.io/npm/dm/animated-scroll-to.svg?style=flat-square)](https://www.npmjs.com/package/animated-scroll-to)\n\nAnimated JavaScript window and element scroll.\nSimple, plain JavaScript scrollTo function.\n\n## Demo\n\nDemo is available on [this page](https://stanko.github.io/animated-scroll-to/).\n\n## What is this?\n\nThis is a plain JavaScript animated scroll to function.\nIt has easing, and accepts speed per 1000px rather than duration.\nThen function recalculates the duration,\nand sets the minimum of 250ms or maximum of 3000ms.\nIf you give it offset which is larger from the maximum scroll value, it will use latter.\nAlso it disables user scrolling while scroll animation is in progress.\nAnd also, you can give it HTML DOM Element to scroll to.\n\nScript doesn't prevent multiple calls of it.\n\n## Installation\n\nGet it from npm\n\n```\nnpm install animated-scroll-to\n```\n\nimport it in your app\n\n```javascript\nimport animateScrollTo from 'animated-scroll-to';\n```\n\nand call it when you need it\n\n```javascript\nanimateScrollTo(500);\n\nor\n\nanimateScrollTo(document.querySelector('.my-element'));\n```\n\nYou can also use the standalone build, by including `animated-scroll-to.js` in your page, but it is not recommended.\n\n## Options\n\n```javascript\n// desiredOffset - page offset to scroll\n// options - object with options\n\n// default options\nconst options = {\n  // duration of the scroll per 1000px, default 500\n  speed: 500,\n\n  // minimum duration of the scroll\n  minDuration: 250,\n\n  // maximum duration of the scroll\n  maxDuration: 1500,\n\n  // DOM element to scroll, default window\n  // Pass a reference to a DOM object\n  // Example: document.querySelector('#element-to-scroll'),\n  element: window,\n\n  // should animated scroll be canceled on user scroll/keypress\n  // if set to \"false\" user input will be disabled until animated scroll is complete\n  cancelOnUserAction: true,\n\n  // function that will be executed when the scroll animation is finished\n  onComplete: function() {}\n};\n\nconst desiredOffset = 1000;\n\nanimateScrollTo(desiredOffset, options);\n```\n\n## Why?\n\nI wasn't able to find standalone, simple and working solution.\n\n## Browser support\n\nAnything that supports `requestAnimationFrame`, meaning IE10+. For IE9 just provide a polyfill for it.\n\nFor IE8 and lower, you'll  need to polyfill `Object.keys` and `Array.forEach` as well. Haven't tested this though.\n\n\n## It is missing &lt;insert feature here&gt;\n\nI really tried to keep simple and lightweight.\nIf you are missing something, feel free to add it and open a pull request.\n","maintainers":[{"name":"daveobriencouk","email":"me@daveobrien.co.uk"}],"time":{"modified":"2022-06-12T16:57:21.512Z","created":"2018-01-15T10:10:36.702Z","1.1.8":"2018-01-15T10:10:36.702Z"},"homepage":"https://github.com/Stanko/animated-scroll-to#readme","keywords":["scroll","scrollTo"],"repository":{"type":"git","url":"git+https://github.com/Stanko/animated-scroll-to.git"},"author":{"name":"Stanko"},"bugs":{"url":"https://github.com/Stanko/animated-scroll-to/issues"},"license":"MIT","readmeFilename":"README.md"}