{"id":21911771,"url":"https://github.com/amiteshhh/ion-smooth-scroll","last_synced_at":"2026-04-11T02:06:22.689Z","repository":{"id":58238398,"uuid":"80974061","full_name":"amiteshhh/ion-smooth-scroll","owner":"amiteshhh","description":"Ionic v1 angular directive for id based smooth scroll","archived":false,"fork":false,"pushed_at":"2017-02-12T19:43:01.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T11:02:14.412Z","etag":null,"topics":["anchorscroll","angular","ionic","smooth-scrolling"],"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/amiteshhh.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":"2017-02-05T06:33:52.000Z","updated_at":"2017-07-03T17:58:18.000Z","dependencies_parsed_at":"2022-08-31T03:01:44.838Z","dependency_job_id":null,"html_url":"https://github.com/amiteshhh/ion-smooth-scroll","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/amiteshhh/ion-smooth-scroll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiteshhh%2Fion-smooth-scroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiteshhh%2Fion-smooth-scroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiteshhh%2Fion-smooth-scroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiteshhh%2Fion-smooth-scroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amiteshhh","download_url":"https://codeload.github.com/amiteshhh/ion-smooth-scroll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiteshhh%2Fion-smooth-scroll/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266094019,"owners_count":23875560,"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":["anchorscroll","angular","ionic","smooth-scrolling"],"created_at":"2024-11-28T18:07:35.251Z","updated_at":"2026-04-11T02:06:22.637Z","avatar_url":"https://github.com/amiteshhh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ion-smooth-scroll\r\n\r\n\r\nAn alternate to [$ionicScrollDelegate.anchorScroll](http://ionicframework.com/docs/api/service/$ionicScrollDelegate) for  smooth scrolling to given `id` without changing the [hash](https://en.wikipedia.org/wiki/Fragment_identifier) of url.\r\n\r\nIonic component `anchorScroll` works unreliably. Below are few issues/limitations with it:\r\n\r\n1. **Content goes out of view** : Sometimes Ionic `anchorScroll` scrolls beyond the target element and therefore part of content area goes out of view and doesn't become visible even when user tries to scroll. \r\n[See this Github Issue](https://github.com/driftyco/ionic/issues/508) or [this issue](https://github.com/driftyco/ionic/issues/618). \r\nThis scenario can be easily reproduced where dynamic data is rendered inside `ion-content`.\r\n2. **No support for _css_ based scrollView** : anchorScroll requires that the scrollable content to use ionic JS scroll (i.e `ion-content` or `ion-scroll` with no `overflow-scroll = true`).\r\n\r\nThis library is intended to provide the lacking functionality of `anchorScroll`.\r\n\r\n\r\n\u003e `ion-smooth-scroll` uses Ionic [$ionicScrollDelegate.scrollTo](http://ionicframework.com/docs/api/service/$ionicScrollDelegate) when\r\nscrollViews created by ionContent and ionScroll directives.\r\n\r\n## Install\r\n\r\nScript file is available from a variety of sources. Choose the one that fits you.\r\n\r\n- Github Source Code https://github.com/amiteshhh/ion-smooth-scroll/blob/master/ion-smooth-scroll.min.js\r\n- Bower `bower install ion-smooth-scroll --save`\r\n- CDN `Raw Git`  https://rawgit.com/amiteshhh/ion-smooth-scroll/master/ion-smooth-scroll.min.js\r\n\r\n## Getting started\r\n\r\nAdd `script` reference to  your application (normally `index.html`)\r\n\r\n```html\r\n\u003cscript src=\"path/to/ion-smooth-scroll.min.js\"\u003e\u003c/script\u003e\r\n```\r\n\r\nAdd the `ion-smooth-scroll` as a dependency in your angular module\r\n\r\n```javascript\r\nangular.module('myApp', ['ion-smooth-scroll']);\r\n```\r\n\r\n### Usage\r\n\r\nDirective is used as an attribute. When clicked it will scroll to the target.\r\n\r\n```html\r\n\u003cANY delegate-handle=\"{string}\"\u003e\u003c!-- scroll view container--\u003e\r\n        \u003cANY ion-smooth-scroll=\"{string}\"\r\n        delegate-handle=\"{string}\"\r\n        duration=\"{number}\"\u003e\r\n        ...\r\n        \u003c/ANY\u003e\r\n\u003c/ANY\u003e\r\n```\r\n\r\n### Parameters\r\n| Param        | Type           | Details  |\r\n| ------------- |:-------------| -----|\r\n| ionSmoothScroll | \u003ca href=\"\" class=\"label type-hint type-hint-string\"\u003estring\u003c/a\u003e | id of DOM element where you want to scroll to.|\r\n| delegateHandle | \u003ca href=\"\"\u003estring\u003c/a\u003e | Value of `delegate-handle` attribute. Both scrollView container and element with `ion-smooth-scroll` must have this attribute even if you use css scrollView. \u003cbr\u003eThis is used only for getting the DOM reference of scrollable container.| \r\n| duration | \u003ca href=\"\" class=\"label type-hint type-hint-number\"\u003enumber\u003c/a\u003e | Scroll transistion duration in millisecond. \u003cbr\u003e**Applicable only for css driven scrollView container.** It will also be ignored if new scroll position is less than _200px_ distance from current postion. You will be rarely passing this parameter :) \u003cbr\u003eYou can also configure it at app level during _angular_ [config Phase](#config) explained later.\u003cbr\u003e _(default: 400)_ | \r\n\r\n\r\n\r\n## Examples\r\n\r\n### 1. With ionic scrollView\r\n\r\n\r\n```html\r\n\u003c!-- Only required attributes has been shown below --\u003e\r\n\u003cion-content delegate-handle=\"main\" id=\"top\"\u003e\r\n    ...\r\n    \u003ca ion-smooth-scroll=\"div1\" delegate-handle=\"main\"\u003eGo to Div 1\u003c/a\u003e\r\n    ...\r\n    \u003cdiv id=\"div1\"\u003e\r\n        ...\r\n    \u003c/div\u003e\r\n    ...\r\n\u003c/ion-content\u003e\r\n```\r\n\r\n### 2. With css scrollView\r\n\r\n\r\nThe only difference is you can pass additional parameter, **duration**, to specify _scroll transition duration_\r\n\r\n```html\r\n\r\n\u003c!--Note that ion-content with overflow-scroll=\"true\" creates the css driven scrollable area.--\u003e\r\n\u003c!--\u003cion-content overflow-scroll=\"true\" delegate-handle=\"main\" id=\"top\"\u003e\r\n                        OR\r\n--\u003e\r\n\r\n\u003c!--This directive is not responsible for making the container scrollable. You need to write your own css.--\u003e\r\n\u003cdiv class=\"my-scrollable-div\" delegate-handle=\"main\" id=\"top\"\u003e\r\n    ...\r\n    \u003ca ion-smooth-scroll=\"div1\" delegate-handle=\"main\"\u003eGo to Div 1\u003c/a\u003e\r\n\r\n    \u003c!--Below link will reach to target in 2 seconds--\u003e\r\n    \u003cbutton ion-smooth-scroll=\"div1\" delegate-handle=\"main\" duration=\"2000\"\u003eGo to Div 1 in 2 Seconds\u003c/button\u003e\r\n    \u003c!-- We can use any element --\u003e\r\n    ...\r\n    \u003cdiv id=\"div1\"\u003e\r\n        ...\r\n    \u003c/div\u003e\r\n    ...\r\n\u003c/div\u003e\r\n```\r\n\r\n\r\n## Config\r\n\r\n\u003e it will not affect the scrollable container created by `ionic-content` or `ion-scroll`.\r\n\r\nConfigure the scroll transistion duration using `ionSmoothScrollProvider.`__`setScrollDuration`__ method _(default: 400 ms)_.\r\n\r\nYou will be rarely using this feature as default value suffices in most of the cases.\r\n\r\n```javascript\r\nangular.module('myApp', ['ion-smooth-scroll'])\r\n    .config(['ionSmoothScrollProvider', function(ionSmoothScrollProvider){\r\n        /*uncomment below line and see it in action\r\n        it will not affect if the scrollable container is created by ionic \r\n        (e.g ion-content or ion-scroll with no overflow-scroll=\"true\")\r\n        */\r\n        \r\n        ionSmoothScrollProvider.setScrollDuration(6000);        \r\n        //ion-smooth-scroll will scroll for 6 seconds to reach the target\r\n    }]);\r\n```\r\n\r\n## Demo\r\n\r\n[Plunker Demo](https://embed.plnkr.co/Y71E3q/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiteshhh%2Fion-smooth-scroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famiteshhh%2Fion-smooth-scroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiteshhh%2Fion-smooth-scroll/lists"}