{"id":19326328,"url":"https://github.com/thisissoon/angular-scroll-collapse","last_synced_at":"2025-12-12T03:43:37.018Z","repository":{"id":57152503,"uuid":"45407651","full_name":"thisissoon/angular-scroll-collapse","owner":"thisissoon","description":"A simple lightweight library for Angular that detects scroll direction and adds a sn-scrolling-up or sn-scrolling-down class to the element. The library can also detect when the user has scrolled passed the element and apply a sn-affix class. Useful for make a element sticky when the user has scrolled beyond it. This library can will also apply sn-minimise class after the user has scrolled beyond the height of the element","archived":false,"fork":false,"pushed_at":"2018-11-22T09:59:16.000Z","size":1270,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-08T02:27:08.759Z","etag":null,"topics":["affix","affix-on-scroll-beyond","angular","collapse","collapse-on-scroll","directive","nav","navbar","ngx","ngx-library","ngx-nav","ngx-sticky-nav","ngx-translate","scrolling","sticky","sticky-navigation-bar"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/thisissoon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-11-02T16:43:21.000Z","updated_at":"2020-04-07T12:44:07.000Z","dependencies_parsed_at":"2022-08-27T18:41:15.123Z","dependency_job_id":null,"html_url":"https://github.com/thisissoon/angular-scroll-collapse","commit_stats":null,"previous_names":["thisissoon/angular-smart-nav"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-scroll-collapse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-scroll-collapse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-scroll-collapse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-scroll-collapse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisissoon","download_url":"https://codeload.github.com/thisissoon/angular-scroll-collapse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903480,"owners_count":17222551,"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":["affix","affix-on-scroll-beyond","angular","collapse","collapse-on-scroll","directive","nav","navbar","ngx","ngx-library","ngx-nav","ngx-sticky-nav","ngx-translate","scrolling","sticky","sticky-navigation-bar"],"created_at":"2024-11-10T02:13:05.835Z","updated_at":"2025-12-12T03:43:31.986Z","avatar_url":"https://github.com/thisissoon.png","language":"TypeScript","readme":"# Angular Scroll Collapse\n\n[![CircleCI][circle-badge]][circle-badge-url]\n[![Coverage Status][coveralls-badge]][coveralls-badge-url]\n[![Commitizen friendly][commitizen-badge]][commitizen]\n[![code style: prettier][prettier-badge]][prettier-badge-url]\n\nA simple lightweight library for [Angular][angular] that detects scroll direction and adds a `sn-scrolling-up` or `sn-scrolling-down` class to the element. The library can also detect when the user has scrolled passed the element and apply a `sn-affix` class. Useful for make a element sticky when the user has scrolled beyond it. This library can will also apply `sn-minimise` class after the user has scrolled beyond the height of the element.\n\nAppropriate events for the above classes are also emitted.\n\nThis is a simple library for [Angular][angular], implemented in the [Angular Package Format v5.0][apfv5].\n\n## Install\n\n### via NPM\n\n`npm i @thisissoon/{angular-scroll-collapse,angular-inviewport} --save`\n\n### via Yarn\n\n`yarn add @thisissoon/angular-scroll-collapse @thisissoon/angular-inviewport`\n\n`app.module.ts`\n\n```ts\nimport { InViewportModule } from '@thisissoon/angular-inviewport';\nimport { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';\n\n@NgModule({\n  imports: [InViewportModule, ScrollCollapseModule],\n})\nexport class AppModule {}\n```\n\n`app.server.module.ts`\n\n```ts\nimport { InViewportModule } from '@thisissoon/angular-inviewport';\nimport { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';\n\n@NgModule({\n  imports: [InViewportModule.forServer(), ScrollCollapseModule],\n})\nexport class AppServerModule {}\n```\n\n## Examples\n\nA working example can be found inside [here](https://github.com/thisissoon/angular-scroll-collapse/tree/master/src).\n\n### Scroll direction\n\n```html\n\u003cnav class=\"foo\" snScrollCollapse (scrollDirectionChange)=\"scrollDirectionHandler($event)\"\u003e\n  ...\n\u003c/nav\u003e\n```\n\n```css\n.foo {\n  height: 100px;\n  left: 0;\n  position: fixed;\n  right: 0;\n  top: 0;\n  transition: all 0.35s ease-in-out;\n}\n\n.foo.sn-scrolling-down {\n  transform: translateY(-100px);\n}\n\n.foo.sn-scrolling-up {\n  transform: translateY(0);\n}\n```\n\n### Affix mode\n\nIn this scenario the nav element will have the class `sn-affix` added when the user scrolls past the header element and the nav is at the top of the viewport.\n\n```html\n\u003cheader\u003e...\u003c/header\u003e\n\u003cnav class=\"foo\" snScrollCollapse (affixChange)=\"affixHandler($event)\"\u003e\n  ...\n\u003c/nav\u003e\n```\n\n```css\n.foo.sn-affix {\n  left: 0;\n  position: fixed;\n  right: 0;\n  top: 0;\n}\n```\n\nA `[yOffset]` can also be applied. Here `sn-affix` will be added when the top of the viewport is within 200 pixels of the top of the nav.\n\n```html\n\u003cheader\u003e...\u003c/header\u003e\n\u003cnav class=\"foo\" snScrollCollapse [yOffset]=\"200\"\u003e\n  ...\n\u003c/nav\u003e\n```\n\n### Minimise mode\n\nIn this scenario the nav element will have the class `sn-minimise` added when the user scrolls 100px (the original height of the element) down the page.\n\n```html\n\u003cheader class=\"foo\" snScrollCollapse (minimiseChange)=\"minimiseHandler($event)\"\u003e\n  ...\n\u003c/header\u003e\n```\n\n```css\n.foo {\n  height: 100px;\n  left: 0;\n  position: fixed;\n  right: 0;\n  top: 0;\n}\n\n.foo.sn-minimise {\n  height: 50px;\n}\n```\n\n### Specify debounce time (default: 0ms)\n\n```html\n\u003cheader class=\"foo\" snScrollCollapse [debounce]=\"500\"\u003e\n  ...\n\u003c/header\u003e\n```\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma][karma].\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor][protractor].\n\n## Making Commits\n\nThis repo uses [Commitizen CLI][commitizen] and [Conventional Changelog][conventional-changelog] to create commits and generate changelogs. Instead of running `git commit` run `git cz` and follow the prompts. Changelogs will then be generated when creating new releases by running `npm run release`.\n\n## Making Releases\n\nRun `npm run release` to create a new release. This will use [Standard Version][standard-version] to create a new release. [Standard Version][standard-version] will generate / update the changelog based on commits generated using [Commitizen CLI][commitizen], update the version number following semantic versioning rules and then commit and tag the commit for the release. Simply run `git push --follow-tags origin master`.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README][angular-cli-readme].\n\n[circle-badge]: https://circleci.com/gh/thisissoon/angular-scroll-collapse.svg?style=shield\n[circle-badge-url]: https://circleci.com/gh/thisissoon/angular-scroll-collapse\n[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-scroll-collapse/badge.svg?branch=master\n[coveralls-badge-url]: https://coveralls.io/github/thisissoon/angular-scroll-collapse?branch=master\n[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield\n[prettier-badge-url]: https://github.com/prettier/prettier\n[angular]: https://angular.io/\n[commitizen]: http://commitizen.github.io/cz-cli/\n[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog\n[standard-version]: https://github.com/conventional-changelog/standard-version\n[karma]: https://karma-runner.github.io\n[protractor]: http://www.protractortest.org/\n[angular-cli]: https://github.com/angular/angular-cli\n[angular-cli-readme]: https://github.com/angular/angular-cli/blob/master/README.md\n[apfv5]: https://goo.gl/jB3GVv\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisissoon%2Fangular-scroll-collapse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisissoon%2Fangular-scroll-collapse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisissoon%2Fangular-scroll-collapse/lists"}