0.7.2 • Published 20 days ago

ngx-tiny-carousel v0.7.2

Weekly downloads
-
License
-
Repository
-
Last release
20 days ago

NgxTinyCarousel

This library is lightweight carousel plugin for Angular.

Demo

https://1105-6601.github.io/ngx-tiny-carousel-demo/

Compatibility

ngx-tiny-carouselAngular
>=0.4.0>=14.2.0

Installation

Add package.

npm i ngx-tiny-carousel --save

Add Module.

@NgModule({
  //
  imports: [
    //
    NgxTinyCarouselModule,
    //
  ],

  bootstrap: [
    //
  ],
})
export class AppModule
{
}

Usage

<div style="width: 400px;">
  <ngx-tiny-carousel [displayCells]="1">
    <ngx-tiny-carousel-cell>
      ...
    </ngx-tiny-carousel-cell>
    <ngx-tiny-carousel-cell>
      ...
    </ngx-tiny-carousel-cell>
    <ngx-tiny-carousel-cell>
      ...
    </ngx-tiny-carousel-cell>
  </ngx-tiny-carousel>
</div>

Image carousel example

ts

@Component({
  selector:    'app',
  templateUrl: './app.component.html',
})
export class CarouselComponent
{
  public imageSources = [
    'https://picsum.photos/400/400',
    'https://picsum.photos/300/400',
    'https://picsum.photos/250/400',
    'https://picsum.photos/400/250',
    'https://picsum.photos/400/300',
  ];
}

html

<div style="width: 400px;">
  <ngx-tiny-carousel [displayCells]="1">
    <ngx-tiny-carousel-cell *ngFor="let src of imageSources">
      <div class="centralise">
        <img [src]="src" alt="">
      </div>
    </ngx-tiny-carousel-cell>
  </ngx-tiny-carousel>
</div>

scss

.centralise {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

Lazy load content

<ngx-tiny-carousel [displayCells]="1">
  <ngx-tiny-carousel-cell *ngFor="let src of imageSources">
    <div class="centralise" *lazyContent>
      <img [src]="src" alt="">
    </div>
  </ngx-tiny-carousel-cell>
</ngx-tiny-carousel>

API

@Input

@InputTypeRequiredDefaultDescription
displayCellsnumberoptional1Cell count to be displayed at once.
cellHeightScalenumberoptional1Specifies the ratio of the cell height to the cell width.
dotPositionstringoptional'inner''inner' or 'outer'.
dotStylestringoptional'dot''dot' or 'bar'.
arrowStylestringoptional'default''default' or 'circle'.
uiScalenumberoptionalnoneUI scale of dots and arrows. This will be calculated in response to container element height automatically.
displayArrowsbooleanoptionaltrueDecide to display arrows or not.
displayDotsbooleanoptionaltrueDecide to display dots or not.
enableDragbooleanoptionalfalseIf set true, The carousel becomes draggable.
enableInfiniteScrollbooleanoptionalfalseMust be used with the enableDrag option. If set true, The carousel becomes infinite scroll.
cellWidthnumberoptional0 (auto)Basically calculated automatically. However, this option may be useful if you nest ngx-tiny-carousel inside a carousel cell that has drag and infinite scroll enabled.
virtualCellMarginnumberoptional1If enableInfiniteScroll is enabled, cell elements are virtualized. In this case, the cells before and after the visible cell can be pre-rendered by the number of cells specified in virtualCellMargin.

Functions

DefinitionDescription
next(count: number = 1)Move to positive direction as much as specified cell count.
prev(count: number = 1)Move to negative direction as much as specified cell count.
jump(cellIndex: number)Move to specific cell index.
0.7.2

20 days ago

0.7.1

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.2

1 year ago

0.5.0

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.3

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.4

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago