Lightbox for Angular
A simple, responsive lightbox component.
Demo
http://ivylab.space/lightbox
Installation
Install npm package for Angular version 8+:
npm i @crystalui/angular-lightbox --save
For Angular 7 and earlier:
npm i @crystalui/angular-lightbox@1.0.6 --save
Import module:
import {CrystalLightboxModule} from '@crystalui/angular-lightbox';
@NgModule({
imports: [CrystalLightboxModule]
})
Usage
You can cluster images into group.
<div lightbox-group>
<img src="path_to_image" lightbox [fullImage]="{path: 'path_to_fullimage'}" />
</div>
Or keep them as separate images.
<img src="path_to_image" lightbox [fullImage]="{path: 'path_to_fullimage'}" />
You don’t need to specify the path to the large image, it’ll work either way.
<img src="path_to_image" lightbox />
Properties
imageMaxHeight: string = "100%"
imageMaxWidth: string = "100%"
counter: boolean = false
counterSeparator: string = "/"
backgroundColor: "black" | "white" = "black"
backgroundOpacity: number = "0.85"
animationDuration: number = "400"
animationTimingFunction: string = "cubic-bezier(0.475, 0.105, 0.445, 0.945)"
closeButtonText: string = "Close"
hideThumbnail: boolean = true
disable: boolean = false
Events
thumbnail:click
{type: "thumbnail:click"}
show-state:initial
{type: "show-state:initial"}
show-state:animation
{type: "show-state:animation"}
show-state:animation-end
{type: "show-state:animation-end"}
closing-state:initial
{type: "closing-state:initial"}
closing-state:animation
{type: "closing-state:animation"}
closing-state:animation-end
{type: "closing-state:animation-end"}
Browser support
NAME | VERSION |
---|
Chrome / Chrome for Android | 50+ / Android 4.4+ |
FireFox | 48+ |
Opera | 44+ |
Safari / iOS Safari | 10.1, 11.1 / iOS 9+ |
Internet Explorer | Edge 15+ |