Socket
Socket
Sign inDemoInstall

ngx-auto-scroll

Package Overview
Dependencies
6
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-auto-scroll

Angular 2+ directive to automatically scroll html container content to the bottom.


Version published
Weekly downloads
472
decreased by-7.27%
Maintainers
1
Install size
40.3 kB
Created
Weekly downloads
 

Readme

Source

Angular 2+ auto scroll directive

Installation

npm install ngx-auto-scroll

Usage

In module:
import {NgxAutoScrollModule} from "ngx-auto-scroll";

@NgModule({
	...
	imports: [ ..., NgxAutoScrollModule]
	...
})
In template:
<div ngx-auto-scroll lock-y-offset="10" observe-attributes>
    <div *ngFor="let message of messages">{{ message }}</div>
</div>
Attributes:

Argument passed to lock-y-offset is bottom offset of scroll position in pixels after scroll container stops auto scroll. Default value is 10.

observe-attributes (optional, default - false) enable listening on attributes changes for example detect changes in font size.

Forcing scroll down

When your DOM element or its parent is hidden auto scroll won't work. There is no simple/pure way to scroll hidden element. The best way is to force scrolling down after the element is shown.

import {NgxAutoScroll} from "ngx-auto-scroll";

@Component({
   selector: 'sample',
})
export class SampleComponent {
    @ViewChild(NgxAutoScroll) ngxAutoScroll: NgxAutoScroll;

    public forceScrollDown(): void {
        this.ngxAutoScroll.forceScrollDown();
    }
}

Building

This component is built as an Angular 5 module using ng-packagr.

npm run ng-build

Publishing

To build and publish this component as an Angular 5 module use

npm run ng-publishing

Keywords

FAQs

Last updated on 01 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc