Gallery

Gallery

Source:
Parameters:
Name Type Description
element HTMLElement

DOM element for component instantiation and scope

options Object
Properties
Name Type Description
galleryItemSelector String

Selector for gallery element

descriptionSelector String

Selector for gallery description element

titleSelector String

Selector for gallery title element

closeButtonSelector String

Selector for close button element

allButtonSelector String

Selector for view all button element

overlaySelector String

Selector for gallery overlay element

overlayHeaderSelector String

Selector for gallery overlay header element

overlayFooterSelector String

Selector for gallery overlay footer element

overlayMediaSelector String

Selector for gallery overlay media element

overlayCounterCurrentSelector String

Selector for gallery overlay current number element

overlayCounterMaxSelector String

Selector for display of number of elements in the gallery overlay

overlayDownloadSelector String

Selector for gallery overlay download element

overlayShareSelector String

Selector for gallery overlay share element

overlayDescriptionSelector String

Selector for gallery overlay description element

overlayPreviousSelector String

Selector for gallery overlay previous link element

overlayNextSelector String

Selector for gallery overlay next link element

videoTitleSelector String

Selector for video title

attachClickListener Boolean

Whether or not to bind click events

attachKeyListener Boolean

Whether or not to bind keyup events

Classes

Gallery

Methods

checkScreen()

Description:
  • Check if current display is desktop or mobile

Source:

destroy()

Description:
  • Destroy component.

Source:

handleClickOnCloseButton()

Description:
  • Invoke listeners for close events.

Source:

handleClickOnItem(e)

Description:
  • Invoke listeners for on click events on the given gallery item.

Source:
Parameters:
Name Type Description
e Event

handleClickOnNextButton()

Description:
  • Invoke listeners for on click events on next navigation link.

Source:

handleClickOnPreviousButton()

Description:
  • Invoke listeners for on click events on previous navigation link.

Source:

handleClickOnViewAll(e)

Description:
  • Invoke listeners for on click events on view all.

Source:
Parameters:
Name Type Description
e Event

handleKeyPressOnItem(e)

Description:
  • Invoke listeners for on pressing the spacebar button.

Source:
Parameters:
Name Type Description
e Event

handleKeyboard(e)

Description:
  • Handles keyboard events such as Escape and navigation.

Source:
Parameters:
Name Type Description
e Event

handleResize()

Description:
  • Trigger events on resize Uses a debounce, for performance

Source:

hideItems(rows/item)

Source:
Parameters:
Name Type Description
rows/item Int

number

Hide several gallery items by default

  • 2 "lines" of items on desktop
  • only 3 items on mobile or the desired rows or items when using the view more button.

init()

Description:
  • Initialise component.

Source:

preventClickOnItem(e)

Description:
  • handle click event on gallery items when no overlay.

Source:
Parameters:
Name Type Description
e Event

updateOverlay(selectedItem)

Source:
Parameters:
Name Type Description
selectedItem HTMLElement

Media element

(static) autoInit(root) → {Gallery}

Source:
Parameters:
Name Type Description
root HTMLElement

DOM element for component instantiation and scope

Returns:

An instance of Gallery.

Type
Gallery