All Projects → leo6104 → ngx-slick-carousel

leo6104 / ngx-slick-carousel

Licence: other
Angular 11+ wrapper for slick plugin

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ngx-slick-carousel

Vue Slick Carousel
🚥Vue Slick Carousel with True SSR Written for ⚡Faster Luxstay
Stars: ✭ 447 (+445.12%)
Mutual labels:  carousel, slick
Vue Agile
🎠 A carousel component for Vue.js
Stars: ✭ 1,167 (+1323.17%)
Mutual labels:  carousel, slick
React Slick
React carousel component
Stars: ✭ 10,067 (+12176.83%)
Mutual labels:  carousel, slick
jquery.circular-carousel
[ABANDONED] A 3D-like circular carousel plugin for jQuery.
Stars: ✭ 49 (-40.24%)
Mutual labels:  carousel
native-gallery
native image gallery in ~100 lines of code
Stars: ✭ 19 (-76.83%)
Mutual labels:  carousel
react-spring-carousel-js
A new Carousel experience for the modern Web
Stars: ✭ 82 (+0%)
Mutual labels:  carousel
react-cool-virtual
😎 ♻️ A tiny React hook for rendering large datasets like a breeze.
Stars: ✭ 1,031 (+1157.32%)
Mutual labels:  carousel
DrinksGalleryApp
Xamarin.Forms goodlooking UI sample using the new CarouselView (Parallax).
Stars: ✭ 51 (-37.8%)
Mutual labels:  carousel
AndroidSliderViewsLibrary
AndroidSliderViewsLibrary is an Android SDK library supports vertical & horizontal carousel and slideshow Views which developers simply integrate on Android project. - by @sung2063
Stars: ✭ 33 (-59.76%)
Mutual labels:  carousel
vue-m-carousel
vue 移动端轮播组件
Stars: ✭ 53 (-35.37%)
Mutual labels:  carousel
v-owl-carousel
🦉 VueJS wrapper for Owl Carousel
Stars: ✭ 46 (-43.9%)
Mutual labels:  carousel
essential-slick
Essential Slick Pandoc Source
Stars: ✭ 36 (-56.1%)
Mutual labels:  slick
react-imageViewer
React component for image displaying in full screen
Stars: ✭ 61 (-25.61%)
Mutual labels:  carousel
IndicatorView
IndicatorView Library For Android
Stars: ✭ 41 (-50%)
Mutual labels:  carousel
svelte-slidy
📸 Sliding action script
Stars: ✭ 211 (+157.32%)
Mutual labels:  carousel
slick-additions
Helpers for the Slick database access library
Stars: ✭ 36 (-56.1%)
Mutual labels:  slick
pinar
🌲☀️ Customizable, lightweight React Native carousel component with accessibility support.
Stars: ✭ 214 (+160.98%)
Mutual labels:  carousel
SimpleSlider
Simple responsive slider created in pure javascript.
Stars: ✭ 21 (-74.39%)
Mutual labels:  carousel
vue-barousel
Carousel component mimics NetEase Cloud Music
Stars: ✭ 13 (-84.15%)
Mutual labels:  carousel
stimulus-carousel
A Stimulus controller to deal with carousel.
Stars: ✭ 22 (-73.17%)
Mutual labels:  carousel

ngx-slick-carousel

npm version Build Status

  1. Support Angular 11+
  2. Support Server side rendering
  3. Support Re-initialize case
  4. Fastest slick init/unslick implementation in Angular

Installation

To install this library, run:

$ npm install jquery --save
$ npm install slick-carousel --save
$ npm install ngx-slick-carousel --save

Consuming your library

Once you have published your library to npm, you can import your library in any Angular application by running:

$ npm install ngx-slick-carousel --save

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import your library
import { SlickCarouselModule } from 'ngx-slick-carousel';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify your library as an import
    SlickCarouselModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  • Include slick css in "styles" at your angular.json file :
  "styles": [
    ...
    "node_modules/slick-carousel/slick/slick.scss",
    "node_modules/slick-carousel/slick/slick-theme.scss",
    ...
  ]
  • Include jquery and slick js in "scripts" at your angular.json file :
  "scripts": [
    ...
    "node_modules/jquery/dist/jquery.min.js",
    "node_modules/slick-carousel/slick/slick.min.js",
    ...
  ]

Once your library is imported, you can use its components, directives and pipes in your Angular application:

  <!-- You can now use your library component in app.component.html -->
    <ngx-slick-carousel class="carousel" 
                        #slickModal="slick-carousel" 
                        [config]="slideConfig" 
                        (init)="slickInit($event)"
                        (breakpoint)="breakpoint($event)"
                        (afterChange)="afterChange($event)"
                        (beforeChange)="beforeChange($event)">
        <div ngxSlickItem *ngFor="let slide of slides" class="slide">
              <img src="{{ slide.img }}" alt="" width="100%">
        </div>
    </ngx-slick-carousel>
    
    <button (click)="addSlide()">Add</button>
    <button (click)="removeSlide()">Remove</button>
    <button (click)="slickModal.slickGoTo(2)">slickGoto 2</button>
    <button (click)="slickModal.unslick()">unslick</button>
@Component({
  ...
})
class ExampleComponent {

  slides = [
    {img: "http://placehold.it/350x150/000000"},
    {img: "http://placehold.it/350x150/111111"},
    {img: "http://placehold.it/350x150/333333"},
    {img: "http://placehold.it/350x150/666666"}
  ];
  slideConfig = {"slidesToShow": 4, "slidesToScroll": 4};
  
  addSlide() {
    this.slides.push({img: "http://placehold.it/350x150/777777"})
  }
  
  removeSlide() {
    this.slides.length = this.slides.length - 1;
  }
  
  slickInit(e) {
    console.log('slick initialized');
  }
  
  breakpoint(e) {
    console.log('breakpoint');
  }
  
  afterChange(e) {
    console.log('afterChange');
  }
  
  beforeChange(e) {
    console.log('beforeChange');
  }
}

(IMPORTANT) If slides variable will be changed dynamically, use trackBy in *ngFor syntax. It will minimize ngxSlickItem directive recreation.

Development

To generate all *.js, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint

Migration from devmark/ngx-slick

  1. npm uninstall ngx-slick --save
  2. npm install ngx-slick-carousel --save
  3. Rename SlickModule.forRoot() to SlickCarouselModule
  4. Rename <ngx-slick> tag name to <ngx-slick-carousel>
  5. Rename #slickModal='slick-modal' template reference to #slickModal='slick-carousel' (exportAs 'slick-carousel')

License

MIT © leo6104

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].