Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-simple-slideshow

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-simple-slideshow

A simple, responsive slideshow for Angular 4+.

  • 1.2.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.4K
decreased by-8.04%
Maintainers
1
Weekly downloads
 
Created
Source
 _  _      ___ _            _     ___ _ _    _        _
| \| |__ _/ __(_)_ __  _ __| |___/ __| (_)__| |___ __| |_  _____ __ __
| .` / _` \__ \ | '  \| '_ \ / -_)__ \ | / _` / -_|_-< ' \/ _ \ V  V /
|_|\_\__, |___/_|_|_|_| .__/_\___|___/_|_\__,_\___/__/_||_\___/\_/\_/
     |___/            |_|

A simple slideshow for Angular 4+.

Click here the check out the demo. Click here the see the slideshow in production on a StoragePug client site, which is what I originally made this slideshow package for.

Features

  • NgSimpleSlideshow has no dependencies besides angular. All animations are 100% CSS, so @angular/animations is not needed.
  • Compiled and packaged in the Angular Package Format v4.0 with ng-packagr.
  • Compiled to es5, so this package is compatible with Angular Universal.
  • AOT ready
  • Responsive and captures swipes from phones and tablets
  • Lazy load option to help with initial pageload speed

Installation

Easy, just npm install:

npm i -S ng-simple-slideshow

Next, import the module:

import {SlideshowModule} from 'ng-simple-slideshow';

@NgModule({
  imports: [
    SlideshowModule,
    ...
  ],
  declarations: [
    ...
  ],
  exports: [
    ...
  ]
})
...

Usage

The simplest use case is the following:

<slideshow [imageUrls]="imageUrlArray"></slideshow>

A more complex example of how I use this in one of my own projects (full list of options in next section):

<slideshow [height]="height"
           [minHeight]="'525px'"
           [autoPlay]="true"
           [showArrows]="false"
           [imageUrls]="imageSources"
           [lazyLoad]="imageSources?.length > 1"
           [autoPlayWaitForLazyLoad]="true">
</slideshow>

More Info on imageUrls

The imageUrls input can be an array of strings, however in order to enable slides to have links, captions, or custom click functions, you must use an object of type IImage instead of a string. For example usage, see here.

Options

Inputs

OptionRequiredDefaultTypeDescription
imageUrlsyes[]string[] or IImage[]array of image urls or IImage
heightno'100%'stringCSS height of slideshow
minHeightnostringCSS min-height of slideshow
arrowSizeno'30px'stringlength of arrow lines
showArrowsnotruebooleanshow or hide the arrows
disableSwipingnofalsebooleanturn swipe detection on or off
autoPlaynofalsebooleanturn autoPlay on or off
autoPlayIntervalno3333numbertime in ms between autoPlay slides
stopAutoPlayOnSlidenotruebooleanstop autoPlay if slideshow is interacted with
autoPlayWaitForLazyLoadnofalsebooleanautoplay to waits for images to lazy load before changing slides
backgroundSizeno'cover'stringoverwrite background-size property
backgroundPositionno'center center'stringoverwrite background-position property
backgroundRepeatno'no-repeat'stringoverwrite background-repeat property
showDotsnofalsebooleanshow clickable dots at the bottom
dotColorno'#FFF'stringcolor of clickable dots at the bottom
showCaptionsnotruebooleanshow or hide captions
captionColorno'#FFF'stringcolor of caption text
captionBackgroundno'rgba(0, 0, 0, .35)'stringcolor of caption background
lazyLoadnofalsebooleanturn on to lazy load images instead of preload
hideOnNoSlidesnofalsebooleanset the slideshow container display to none if imageUrls is empty, null, or undefined
fullscreennofalsebooleanactivate full screen for the slideshow on true, go back to normal view on false

Output Events

EventDescription
onSlideLeftwhen the left arrow is clicked
onSlideRightwhen the right arrow is clicked
onSwipeLeftwhen a swipe left occurs
onSwipeRightwhen a swipe right occurs
onFullscreenExitwhen fullscreen exits
onIndexChangedwhen slide index changes

Note: all events emit the index number of the new slide

API

Take control of the slideshow if you want! Simply create a reference to your slideshow like so:

<slideshow #slideshow [imageUrls]="imageUrlArray"></slideshow>

and in your component.ts reference it as a ViewChild:

@ViewChild('slideshow') slideshow: any;

Now you can access the public members such as the goToSlide and onSlide:

this.slideshow.goToSlide(3); // go to slide index 3 (i.e. imageUrls[3])
this.slideshow.onSlide(1); // next slide
this.slideshow.onSlide(-1); // previous slide

Keywords

FAQs

Package last updated on 22 Mar 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc