ngx-gallery is a simple but full-featured image gallery for Angular 2/4 apps.
angular image gallery example, ngx image gallery, angular material image gallery, angular gallery grid, angular image gallery with thumbnails
Features:
- Custom layout
- Navigation arrows
- Autoplay
- Multi-row thumbnail navigation
- Fullscreen mode
- Touch-enabled
- Custom animations
How to make use of it:
Installation
npm install ngx-gallery --save
Usage
// app.module.ts import { NgxGalleryModule } from 'ngx-gallery'; ... @NgModule({ imports: [ ... NgxGalleryModule ... ], ... }) export class AppModule { }
// app.component.ts import { Component, OnInit } from '@angular/core'; import { NgxGalleryOptions, NgxGalleryImage, NgxGalleryAnimation } from 'ngx-gallery'; ... @Component({ templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { galleryOptions: NgxGalleryOptions[]; galleryImages: NgxGalleryImage[]; ngOnInit(): void { this.galleryOptions = [ { width: '600px', height: '400px', thumbnailsColumns: 4, imageAnimation: NgxGalleryAnimation.Slide }, // max-width 800 { breakpoint: 800, width: '100%', height: '600px', imagePercent: 80, thumbnailsPercent: 20, thumbnailsMargin: 20, thumbnailMargin: 20 }, // max-width 400 { breakpoint: 400, preview: false } ]; this.galleryImages = [ { small: 'assets/1-small.jpg', medium: 'assets/1-medium.jpg', big: 'assets/1-big.jpg' }, { small: 'assets/2-small.jpg', medium: 'assets/2-medium.jpg', big: 'assets/2-big.jpg' }, { small: 'assets/3-small.jpg', medium: 'assets/3-medium.jpg', big: 'assets/3-big.jpg' } ]; } }
// app.component.html <ngx-gallery [options]="galleryOptions" [images]="galleryImages"></ngx-gallery>
NgxGalleryOptions
width
| Type:string
| Default value:'500px'
– gallery widthheight
| Type:string
| Default value:'400px'
– gallery heightbreakpoint
| Type:number
| Default value:undefined
– responsive breakpoint, works like media query max-widthfullWidth
| Type:boolean
| Default value:false
– sets the same width as the browserlayout
| Type:string
| Default value:NgxGalleryLayout.Bottom
– sets thumbnails positionstartIndex
| Type:number
| Default value:0
– sets the index of the selected image on the startlinkTarget
| Type:string
| Default value:_blank
– sets the target attribute of the linklazyLoading
| Type:boolean
| Default value:true
– enables/disables lazy loading for imagesimage
| Type:boolean
| Default value:true
– enables or disables imageimageDescription
| Type:boolean
| Default value:true
– enables or disables description for imagesimagePercent
| Type:number
| Default value:75
– percentage heightimageArrows
| Type:boolean
| Default value:true
– enables or disables arrowsimageArrowsAutoHide
| Type:boolean
| Default value:false
– enables or disables arrows auto-hideimageSwipe
| Type:boolean
| Default value:false
– enables or disables swipeimageAnimation
| Type:string
| Default value:NgxGalleryAnimation.Fade
– animation typeimageSize
| Type:string
| Default value:NgxGalleryImageSize.Cover
– image sizeimageAutoPlay
| Type:boolean
| Default valuefalse
– enables or disables autoplayimageAutoPlayInterval
| Type:number
| Default value:2000
– interval for auto play (ms)imageAutoPlayPauseOnHover
| Type:boolean
| Default value:false
– enables or disables pouse auto play on hoverimageInfinityMove
| Type:boolean
| Default value:false
– enables or disables infinity move by arrowsimageActions
| Type:NgxGalleryAction[]
| Default value:[]
– Array of custom actionsimageBullets
| Type:boolean
| Default value:false
– enables or disables navigation bulletsthumbnails
| Type:boolean
| Default value:true
– enables or disables thumbnailsthumbnailsColumns
| Type:number
| Default value:4
– columns countthumbnailsRows
| Type:number
| Default value:1
– rows countthumbnailsPercent
| Type:number
| Default value:25
– percentage heightthumbnailsMargin
| Type:number
| Default value:10
– the margin between thumbnails and imagethumbnailsArrows
| Type:boolean
| Default value:true
– enables or disables arrowsthumbnailsArrowsAutoHide
| boolean:string
| Default value:false
– enables or disables arrows auto-hidethumbnailsSwipe
| Type:boolean
| Default value:false
– enables or disables swipethumbnailsMoveSize
| Type:number
| Default value:1
– number of items to move on arrow clickthumbnailsOrder
| Type:number
| Default value:NgxGalleryOrder.Column
– images orderthumbnailsRemainingCount
| Type:boolean
| Default value:false
– if true arrows are disabled and the last item has a label with the remaining countthumbnailsAsLinks
| Type:boolean
| Default value:false
– enables or disables links on thumbnailsthumbnailsAutoHide
| Type:boolean
| Default value:false
– hides thumbnails if there is only one imagethumbnailMargin
| Type:number
| Default value:10
– the margin between images in thumbnailsthumbnailSize
| Type:string
| Default value:NgxGalleryImageSize.Cover
– thumbnail sizethumbnailActions
| Type:NgxGalleryAction[]
| Default value:[]
– Array of custom actionspreview
| Type:boolean
| Default value:true
– enables or disables previewpreviewDescription
| Type:boolean
| Default value:true
– enables or disables description for imagespreviewArrows
| Type:boolean
| Default value:true
– enables or disables arrowspreviewArrowsAutoHide
| boolean:string
| Default value:false
– enables or disables arrows auto-hidepreviewSwipe
| Type:boolean
| Default value:false
– enables or disables swipepreviewFullscreen
| Type:boolean
| Default value:false
– enables or disables fullscreen iconpreviewForceFullscreen
| Type:boolean
| Default value:false
– enables or disables opening preview in fullscreen modepreviewCloseOnClick
| Type:boolean
| Default value:false
– enables or disables closing preview by clickpreviewCloseOnEsc
| Type:boolean
| Default value:false
– enables or disables closing preview by ESC keyboardpreviewKeyboardNavigation
| Type:boolean
| Default value:false
– enables or disables navigation by keyboardpreviewAnimation
| Type:boolean
| Default value:true
– enables or disables image loading animationpreviewAutoPlay
| Type:boolean
| Default valuefalse
– enables or disables autoplaypreviewAutoPlayInterval
| Type:number
| Default value:2000
– interval for auto play (ms)previewAutoPlayPauseOnHover
| Type:boolean
| Default value:false
– enables or disables pouse auto play on hoverpreviewInfinityMove
| Type:boolean
| Default value:false
– enables or disables infinity move by arrowspreviewZoom
| Type:boolean
| Default value:false
– enables or disables zoom in and zoom outpreviewZoomStep
| Type:number
| Default value:0.1
– step for zoom changepreviewZoomMax
| Type:number
| Default value:2
– max value for zoompreviewZoomMin
| Type:number
| Default value:0.5
– min value for zoompreviewRotate
| Type:boolean
| Default value:false
– enables or disables rotate buttonspreviewDownload
| Type:boolean
| Default value:false
– enables or disables the download buttonpreviewBullets
| Type:boolean
| Default value:false
– enables or disables navigation bulletsarrowPrevIcon
| Type:string
| Default value:'fa fa-arrow-circle-left'
– icon for prev arrowarrowNextIcon
| Type:string
| Default value:'fa fa-arrow-circle-right'
– icon for the next arrowcloseIcon
| Type:string
| Default value:'fa fa-times-circle'
– icon for the close buttonfullscreenIcon
| Type:string
| Default value:'fa fa-arrows-alt'
– icon for the fullscreen buttonspinnerIcon
| Type:string
| Default value:'fa fa-spinner fa-pulse fa-3x fa-fw'
– icon for the spinnerzoomInIcon
| Type:string
| Default value:'fa fa-search-plus'
– icon for zooming inzoomOutIcon
| Type:string
| Default value:'fa fa-search-minus'
– icon for zoom outrotateLeftIcon
| Type:string
| Default value:'fa fa-undo'
– icon for rotating leftrotateRightIcon
| Type:string
| Default value:'fa fa-repeat'
– icon for rotating rightdownloadIcon
| Type:string
| Default value:'fa fa-arrow-circle-down'
– icon for downloadactions
| Type:NgxGalleryAction[]
| Default value:[]
– Array of new custom actions that will be added to the left of the current close/zoom/fullscreen icons
NgxGalleryImage
small
| Type:string | SafeResourceUrl
– URL used in thumbnailsmedium
| Type:string | SafeResourceUrl
– URL used in imagebig
| Type:string | SafeResourceUrl
– URL used in previewdescription
| Type:string
– a description used in the previewurl
| Type:string
– The URL used in the linklabel
| Type:string
– a label used for aria-label when the thumbnail is a link
NgxGalleryAnimation
Fade
(default)Slide
Rotate
Zoom
NgxGalleryImageSize
Cover
(default)Contain
NgxGalleryLayout
Top
Bottom
(default)
NgxGalleryOrder
Column
(default)Row
Page
Examples for
NgxGalleryAction
icon
| Type:string
– icon for custom actiondisabled
| Type:boolean
| Default value:false
– if the icon should be disabledtitleText
| Type:string
| Default value:''
– text to set the title attribute toonClick
| Type:(event: Event, index: number) => void
– Output function to call when custom action icon is clicked
Events
change
– triggered on image changeimagesReady
– triggered when images length > 0previewOpen
– triggered on preview openpreviewClose
– triggered on preview closepreviewChange
– triggered on preview image change
Methods
show(index: number): void
– shows the image at the indexshowNext(): void
– shows the next imageshowPrev(): void
– shows prev imagecanShowNext(): boolean
– returns true if there is the next imagecanShowPrev(): boolean
– returns true if there is prev imageopenPreview(index: number): void
– opens preview at indexmoveThumbnailsLeft(): void
– moves thumbnails to leftmoveThumbnailsRight(): void
– moves thumbnails to the rightcanMoveThumbnailsLeft(): boolean
– returns true if you can move thumbnails to leftcanMoveThumbnailsRight(): boolean
– returns true if you can move thumbnails to the right
angular 2/4 image gallery, ngx-gallery Plugin/Github, ngx gallery github, angular image collage
See Demo And Download
Official Website(lukasz-galka): Click Here
This superior jQuery/javascript plugin is developed by lukasz-galka. For extra advanced usage, please go to the official website.