Lightbox
in package
Set the simplelightbox options and enqueue the scripts.
Tags
Table of Contents
Constants
- LIGHTBOX_DEFAULTS = array('animationSlide' => false, 'captionsData' => 'data-caption', 'disableRightClick' => true, 'disableScroll' => true, 'heightRatio' => 0.85, 'loop' => false, 'overlayOpacity' => 1, 'showCounter' => false, 'widthRatio' => 0.95)
- Default options for the lightbox.
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
Methods
- enqueue_assets() : void
- Enqueue the gallery CSS and javascript.
- get_instance() : object
- Creates and/or returns the instance of this class.
- __construct() : void
- Initialise the class and set its properties.
- get_inline_script() : string
- Get the SimpleLightbox inline JavaScript.
Constants
LIGHTBOX_DEFAULTS
Default options for the lightbox.
protected
array<string|int, mixed>
LIGHTBOX_DEFAULTS
= array('animationSlide' => false, 'captionsData' => 'data-caption', 'disableRightClick' => true, 'disableScroll' => true, 'heightRatio' => 0.85, 'loop' => false, 'overlayOpacity' => 1, 'showCounter' => false, 'widthRatio' => 0.95)
The lightbox display settings. @type bool $animationSlide Whether to slide in new photos or not. Default is fade. @type string $captionsData The attribute containing the image caption. @type bool $disableRightClick Disable right click flag. Default is true, false for logged-in users. @type bool $disableScroll Stop scrolling page if lightbox is opened. @type float $heightRatio Ratio of image height to screen height. Note this does NOT change image aspect ratio. @type bool $loop Enable looping through images. Default is false. Will need styling if enabled. @type float $overlayOpacity The opacity of the background overlay. @type bool $showCounter Show current image index or not. Default is false. Will need styling if enabled. @type float $widthRatio Ratio of image width to screen width. Note this does NOT change image aspect ratio.
Tags
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
Methods
enqueue_assets()
Enqueue the gallery CSS and javascript.
public
enqueue_assets() : void
Tags
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
__construct()
Initialise the class and set its properties.
protected
__construct() : void
Tags
get_inline_script()
Get the SimpleLightbox inline JavaScript.
protected
get_inline_script() : string
Tags
Return values
string —The inline script.