Gallery

The Gallery module renders "flat galleries" in an article in a gallery modal.

Source:
Properties:
Name Type Description
selectors Object

DOM element selectors

states Object

different css states

templates Object

different templates used for populating the gallery

$flatGalleries Array

an array of flag galleries found in the article

$activeGallery HTMLElement

the current gallery

$currentSlide HTMLElement

the current gallery slide

$prevBtn HTMLElement

the previous slide button

$nextBtn HTMLElement

the next slide button

$closeBtn HTMLElement

the close button

$body HTMLElement

the body element

$html HTMLElement

the root HTML Element

keyboardListener: function

keyboard key up listener

uniqueAdCount: Integer

0 - a unique count of ads created

adFrequency Integer

how frequent does the ad refresh, i.e. refresh the ad per N slides

maxWidth Integer

maximum width for gallery image in gallery modal

adData Object

Ad data for rendering ads

Methods

(inner) close(evt)

Source:

Close the active gallery with an animation.

Parameters:
Name Type Description
evt Event

mouse click event.

(inner) copySlide(HTMLElement, HTMLElement)

Source:

Copy respective image data from a source image slide from a flat gallery to the destination slide in the gallery modal.

Parameters:
Name Type Description
HTMLElement

$slide - empty slide in the gallery modal

HTMLElement

$source - source slide in the flat gallery

(inner) destroy()

Source:

Completely remove the active gallery and the reference to it.

(inner) goToSlide(index, $caller)

Source:

Navigate to a specific slide in a gallery.

Parameters:
Name Type Description
index Integer

index of the slide to navigate to

$caller HTMLElement

HTML Element which triggered the slide navigation

(inner) imageLoad($slide)

Source:

Flag a slide as being loaded

Parameters:
Name Type Description
$slide HTMLElement

slide where the loaded image resides in

(inner) init()

Source:

Select flag galleries in an article and set up click listeners to trigger the gallery modal.

(inner) initializeGallery(galleryIndex, imageIndex, Event)

Source:

Initialize a selected gallery, with the selected slide opened.

Parameters:
Name Type Description
galleryIndex Integer

index of selected gallery (there could be multiple galleries)

imageIndex Integer

index of the selected slide

Event Event

click event

(inner) initializeSocialShare()

Source:

Fetch social share templates via an ajax call. Populate the social share UI.

(inner) interactWithKeyboard(evt)

Source:

Navigate to next / previous slide with arrow keys, close with ESC key.

Parameters:
Name Type Description
evt Event

key up event

(inner) nextSlide(evt)

Source:

Navigate to the next slide

Parameters:
Name Type Description
evt Event

button click event

(inner) preload($slide)

Source:

Preload an image within a gallery slide

Parameters:
Name Type Description
$slide HTMLElement

gallery slide

(inner) prevSlide(evt)

Source:

Navigate to the previous slide.

Parameters:
Name Type Description
evt Event

button click event

(inner) refreshAd()

Source:

Create or refresh an already created ad.

(inner) showSocialShare()

Source:

Populate social share component with social share template.

(inner) track($elem, details)

Source:

Analytics tracking.

Parameters:
Name Type Description
$elem HTMLElement

element triggering click tracking

details Object

additional details to be sent for tracking