{"id":15046312,"url":"https://github.com/jmandreslopez/ng2-track-scroll","last_synced_at":"2025-10-26T17:31:13.811Z","repository":{"id":85116315,"uuid":"82333661","full_name":"jmandreslopez/ng2-track-scroll","owner":"jmandreslopez","description":"Track Scroll for Angular2","archived":false,"fork":false,"pushed_at":"2017-06-15T19:59:55.000Z","size":28,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T21:52:36.541Z","etag":null,"topics":["angular","angular-cli","angular2","javascript","track-scroll","typescript"],"latest_commit_sha":null,"homepage":null,"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/jmandreslopez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-17T20:05:25.000Z","updated_at":"2023-01-30T22:52:23.000Z","dependencies_parsed_at":"2023-05-22T17:45:41.763Z","dependency_job_id":null,"html_url":"https://github.com/jmandreslopez/ng2-track-scroll","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.0625,"last_synced_commit":"da528483a0928331a51a5b2bf94817e1c4745f77"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmandreslopez%2Fng2-track-scroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmandreslopez%2Fng2-track-scroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmandreslopez%2Fng2-track-scroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmandreslopez%2Fng2-track-scroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmandreslopez","download_url":"https://codeload.github.com/jmandreslopez/ng2-track-scroll/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238375171,"owners_count":19461562,"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":["angular","angular-cli","angular2","javascript","track-scroll","typescript"],"created_at":"2024-09-24T20:52:58.753Z","updated_at":"2025-10-26T17:31:08.530Z","avatar_url":"https://github.com/jmandreslopez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ng2-track-scroll [![npm version](https://img.shields.io/npm/v/ng2-track-scroll.svg?style=flat)](https://www.npmjs.com/package/ng2-track-scroll) [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n\nTrack Scroll for Angular2\n\n## Features\n\n- easy-to-use directive: tracks when element enters a certain point of the window just by adding `trackScroll` directive\n- customizable: adjust tracker position, and pixel offset\n\n## Quick Start\n\n```\nnpm install ng2-track-scroll --save\n```\n\n## Table of contents\n\n- [Setup](#setup)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Demo](#demo)\n\n## Setup\n\nFirst you need to install the npm module:\n```sh\nnpm install ng2-track-scroll --save\n```\n\nThen add the `Ng2TrackScrollModule` to the imports array of your application module (or a shared module):\n\n```typescript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { Ng2TrackScrollModule } from 'ng2-track-scroll'; // \u003c-- import the module\nimport { AppComponent} from './app.component';\n\n@NgModule({\n    imports: [\n      BrowserModule, \n      Ng2TrackScrollModule.forRoot() // \u003c-- include it in your app module\n    ], \n    declarations: [AppComponent],\n    bootstrap: [AppComponent]\n})\nexport class AppModule {\n  //\n}\n```\n\n## Usage \n\nIn your template you should add the `trackScroll` attribute to elements you want to enable tracking.\nAs soon as the tracking point gets past an `trackScrollEnter` event will be triggered, and as soon as the height of the element gets past an `trackScrollLeave` event will be triggered.\n\n```js\n\n@Component({\n   selector: 'main-element',\n   template: `\n        ...\n        \u003ch1 trackScroll \n            (trackScrollEnter)=\"enter()\" \n            (trackScrollLeave)=\"leave()\"\u003eComponent Title\u003c/h1\u003e\n        \u003c!-- Further content here --\u003e\n        ...\n   `\n})\nexport class MainElementComponent {\n  \n  enter() {\n    console.log('Track scroll enter is working!');\n  }\n\n  leave() {\n    console.log('Track scroll leave is working too!');\n  }\n}\n```\n\n## Configuration\n\nIn your template you could pass some configurations, adding `[trackScrollConfig]=\"{ ... }\"` with any of the options to overwrite.\n\n| Option           | Type    | Default  | Description   |\n| ---------------- | ------- | -------- |-------------- |\n| `position`       | string  | 'middle' | Position of the tracking point. \u003cbr\u003e Options: 'top', 'middle', 'bottom'\n| `offset`         | number  | 0 (px)   | Amount of pixels to add to the tracking point\n| `offsetPosition` | string  | 'bottom' | If you select position 'middle' and specify an offset amount, you could indicate if you want to add them on above or below the tracking point. \u003cbr\u003e Options: 'top, 'bottom'\n\n```js\n\n@Component({\n   selector: 'main-element',\n   template: `\n        ...\n        \u003ch1 trackScroll [trackScrollConfig]=\"{ position: 'top', offset: 300 }\" \n            (trackScrollEnter)=\"enter()\"\n            (trackScrollLeave)=\"leave()\"\u003eComponent Title\u003c/h1\u003e\n        \u003c!-- Further content here --\u003e\n        ...\n   `\n})\nexport class MainElementComponent {\n  \n  enter() {\n    console.log('Track scroll enter is working!');\n  }\n\n  leave() {\n    console.log('Track scroll leave is working too!');\n  }\n}\n```\n\n## Demo\n\nThe [demo](demo) subfolder contains a project created with angular-cli that has been adapted to showcase the functionality of ng2-track-scroll.\nTo execute the code follow this steps:\n\n```\n// Go the the demo folder\ncd demo\n\n// Install dependencies\nnpm install\n\n// Run the server\nng serve\n```\n\nThen go to [http://localhost:4200](http://localhost:4200/) to check the demo running.\n\n## TODO:\n\n* Test across browsers\n* Implement a debug option\n* Add tests to the library and demo\n* Add new configurations\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmandreslopez%2Fng2-track-scroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmandreslopez%2Fng2-track-scroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmandreslopez%2Fng2-track-scroll/lists"}