1.0.0 • Published 2 years ago

@poseclop/ngx-carousel v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

About

Main features

  • Lightweight, no nonsense carousel component
  • Can be set to scroll vertically or horizontally
  • Can use the autoplay attribute to scroll automatically

Getting Started

Prerequisites

This component is only available for Angular projects.

Installation

  1. Install the package
npm install @Poseclop/ngx-carousel

or

yarn add @Poseclop/ngx-carousel
  1. Import the module in your application
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    NgxCarouselModule,
    ...
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Add the component in your application. The carousel will display all the children of the component.
<ngx-carousel [autoplay]="2000" [scrollDirection]="'horizontal'">
  <ng-template ngxCarouselItem>
    <p>Page 1</p>
  </ng-template>
  <ng-template ngxCarouselItem>
    <p>Page 2</p>
  </ng-template>
  <ng-template ngxCarouselItem>
    <p>Page 3</p>
  </ng-template>
</ngx-video-player>

Usage

Inputs

InputTypeDefaultDescription
autoplaynumber0Time in milliseconds between each scroll. If set to 0, the carousel will not scroll automatically.
scrollDirectionstring'horizontal'Direction of the scroll. Can be 'horizontal' or 'vertical'.
scrollTimenumber500Time in milliseconds for the scroll animation.
scrollSensitivitynumber0.5The sensitivity of the scroll. Number between 0 and 1.

Outputs

OutputEvent typeDescription
pageChangeNumberEvent emitted when the page changes.

Methods

MethodDescription
next()Scroll to the next page.
previous()Scroll to the previous page.
goToPage(page: number)Scroll to the specified page.
1.0.0

2 years ago