Lightbox
Lightbox
is a UI component for displaying images by filling the screen and dimming out the rest of the application.
Learn more about the Lightbox plugin.
constructorβ
constructor(options?: Lightbox.Options);
The ui.Lightbox
constructor accepts several parameters:
titleβ
[optional] The image caption.
imageβ
[required] The path or URL to the image.
topβ
[optional] The distance from the top edge of the image to the top of the screen. The default is 100
.
windowAreaβ
[optional] The maximum percentage of the screen covered by lightbox.The default is 0.8
.
closeAnimationβ
[optional] Set to false
if you don't want the lightbox to be closed in an animated fashion.
closeButtonβ
[optional] Set to false
if you don't want to display the small close button in the top left corner of the lightbox.
Note that the lightbox will still be closable by clicking anywhere outside the lightbox area.
downloadableβ
[optional] If true
, a default download button is added to the lightbox (after any buttons
specified). When clicked,
this button triggers the downloadAction
('download'
by default).
fileNameβ
[optional] The filename of downloaded images. By default, the downloaded images are named 'Image'
.
downloadActionβ
[optional] If the action action:[downloadAction]
is triggered on the lightbox, the lightbox image
is downloaded to
the user computer. By default, the download action is 'download'
. Downloaded images will have fileName
as filename.
buttonsβ
[optional] Buttons to show under the lightbox title
. Explained in Dialog. Specifically,
a custom download button can be created by providing a button that has downloadAction
as its action ('download'
by
default).
Methodsβ
open()β
lightbox.open(): this;
Open the lightbox.
close()β
lightbox.close(): this;
Close the lightbox.
on()β
Register a handler function that will be called whenever eventName
is triggered. The optional context
is an object
that will be the context of the handler function (the this
).
lightbox.on(eventName: string, callback: EventHandler, context?: any): this;
Eventsβ
close:animation:completeβ
Triggered when the lightbox is actually removed from the DOM, i.e. when the close animation finishes.
closeβ
Triggered when the lightbox gets closed.
Typesβ
Easingβ
type Easing = string;
Optionsβ
Lightbox.Options extends Dialog.Options.
interface Options extends Dialog.Options {
image: string;
downloadable?: boolean;
fileName?: string;
closeAnimation?: {
delay?: number;
duration?: number;
easing?: Easing;
properties?: {
opacity?: number
}
};
top?: number;
windowArea?: number;
openAnimation?: boolean
}