1.0.3 • Published 6 years ago

ngx-banner-carousel-moby v1.0.3

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

Ngx Banner Carousel Moby.

Very lightweight carousel angular component. Carousel already contains default css. But it's easily customizable;

Live demo: https://pavelpleshko-carousel.now.sh

Screenshot: screen carousel

Installation

npm install ngx-banner-carousel-moby --save

How to use

Include BannerCarouselModule into your module like so:

import { BannerCarouselModule } from 'ngx-banner-carousel-moby/dist';
...
@NgModule({
  imports: [
    BannerCarouselModule
  ],
})
export class YourModule { }

Inclusion of module will give you access to the carousel component which you can include in your components. Example:

<ngx-carousel-moby [slides]="slides" [config]="config"></ngx-carousel-moby>

Providing data

Main data that is pictures,captions and links is provided through slides input array. Example:

slides=[
{src:'/assets/slider0.jpg',caption:{
	header:'Slider 0',
	subheader:'Subheading 0',
	callToActionBtn:{
		text:'Shop',
		link:'/shop'
}}},
{src:'/assets/slider1.jpg',caption:{
	header:'Slider 1',
	subheader:'Subheading 1',
	callToActionBtn:{
		text:'Shop',
		link:'/shop'
}
}},
etc
...
];

Secondary data that is config looks like following and is not required for carousel to work:

config:any={
	autoplay:boolean,
	transitionTime:number,
	delay:number,
	firstSlideIndex:number,
	backwards:boolean,
	repeat:boolean,
  animationName:string,
  points:{
    visible:boolean,
    pointClass:string
  },
  controls:{
    visible:boolean,
    controlClass:string
  },
  caption:{
    enabled:boolean
  }
};
PropTypeDefaultDescription
autoplaybooleantrueWhether or not automatically change slides
transitionTimenumber500Animation time between slides in milliseconds
delaynumber3000It is used for time taken to slide the number items
firstSlideIndexnumber0Starts with the provided index of slide
backwardsbooleanfalsedetermines the direction of how carousel changes slides
repeatbooleantrueIf false then once carousel reached last slide it stops rotation of the slides
animationNamestringslideNow supports two animations: slide(default) and fadeIn
pointsObjectvisible:true,pointClass:'custom-point'Customizes visibility and adds a custom class to the points of the carousel
controlsObjectvisible:true,pointClass:'custom-control'Customizes visibility and adds a custom class to the controls of the carousel
captionObjectenabled:trueWhether or not display caption for the slide

Events

slideChanged - emits index of the current slide

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago