CorvidReference

GalleryItemClickedEvent

Event that is fired when an image in a gallery is clicked.

Table of Contents

PROPERTIES

?
Store values associated with an object.
itemGets the gallery item.
itemIndexGets the gallery item's index.
contextGets the context of the event on a repeated element.
targetGets the element that the event was fired on.
typeGets the type of event that was fired.

MIXES IN

?
Where some functionality is inherited from.
$w.GalleryItemChangedEvent, $w.Event

item

Gets the gallery item.

Syntax

get item(): ImageItem | VideoItem

MIXED IN FROM

?
Where this functionality is inherited from.
$w.GalleryItemChangedEvent

Examples

Get the event's item

$w("#myGallery").onEvent( (event) => {
  let imageSrc = event.item.src;           // "5a474679eac844e3a2.jpg"
  let imageDesc = event.item.description;  // "Image description"
  let imageTitle = event.item.title;       // "Alt text"
  let imageLink = event.item.link;         // "http://www.wix.com"
  let imageTarget = event.item.target;     // "_blank"
} );

itemIndex

Gets the gallery item's index.

Syntax

get itemIndex(): number
TYPE
?
The kind of data the property stores.
number

MIXED IN FROM

?
Where this functionality is inherited from.
$w.GalleryItemChangedEvent

Examples

Get the event's item index

$w("#myGallery").onEvent( (event) => {
  let imageSrc = event.itemIndex; // 3
} );

context

Gets the context of the event on a repeated element.

Description

An event's context contains information about the circumstances surrounding the firing of the event. The context property only appears in events on repeated elements.

You can use the event context with $w.at() to get a selector function which selects items from a specific repeater item. It contains an object with one key:value pair. The key is "itemId" and the value is the ID of the repeated item on which the event occurred.

Syntax

get context(): EventContext

MIXED IN FROM

?
Where this functionality is inherited from.
$w.GalleryItemChangedEvent

Examples

Get the context of the event

// non-repeater event

$w("#myElement").onEvent( (event) => {
  let type = event.context.type; // "GLOBAL_SCOPE"
} );


// repeater event

$w("#myRepeatedElement").onEvent( (event) => {
  let $item = $w.at(event.context)
  $item("#anotherRepeatedElement").value = "new value";

  let itemId = event.context.itemId;  // "item1"
} );

target

Gets the element that the event was fired on.

Syntax

get target(): Element
TYPE
?
The kind of data the property stores.

MIXED IN FROM

?
Where this functionality is inherited from.
$w.GalleryItemChangedEvent

Examples

Get the ID of the target element

$w("#myElement").onEvent( (event) => {
  let targetId = event.target.id;  // "myElement"
} );

type

Gets the type of event that was fired.

Syntax

get type(): string
TYPE
?
The kind of data the property stores.
string

MIXED IN FROM

?
Where this functionality is inherited from.
$w.GalleryItemChangedEvent

Examples

Get the type of the event

$w("#myElement").onEvent( (event) => {
  let eventType = event.type; // "click"
} );