new StoryCard(element, options)
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
HTMLElement | DOM element for component instantiation and scope |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
Properties
|
Classes
Members
goToNextGridItem
- Description:
Move the grid accordion to the next item.
- Source:
Move the grid accordion to the next item.
goToPreviousGridItem
- Description:
Move the grid accordion to the previous item.
- Source:
Move the grid accordion to the previous item.
handleGridPauseClick
- Description:
Handle the click on the pause button.
- Source:
Handle the click on the pause button.
handleGridPlayClick
- Description:
Handle the click on the pause button.
- Source:
Handle the click on the pause button.
handleProgressEnd
- Description:
Move the grid accordion to the next item when the css animation ends.
- Source:
Move the grid accordion to the next item when the css animation ends.
(static) supportedEvents :Array.<string>
- Description:
An array of supported events for this component.
- Source:
An array of supported events for this component.
Type:
- Array.<string>
Methods
applyGridDetailsHeight()
- Description:
Set every grid details panel to the height of the tallest one.
- Source:
attachListeners()
- Description:
Attach event listeners.
- Source:
destroy()
- Description:
Destroy the component.
- Source:
init()
- Description:
Initialise the component.
- Source:
initCarousel()
- Description:
Initialize Embla carousel.
- Source:
initGridAccordion()
- Description:
Initialize desktop grid accordion.
- Source:
on(eventName, callback) → {void}
- Description:
Register a callback function for a specific event.
- Source:
Example
// Registering a callback for the 'onSelection' event
storyCard.on('onSelection', (event) => {
console.log('Selection event occurred!', event);
});
Parameters:
| Name | Type | Description |
|---|---|---|
eventName |
string | The name of the event to listen for. |
callback |
function | The callback function to be invoked when the event occurs. |
Returns:
- Type
- void
onWindowResize()
- Description:
Handle window resize.
- Source:
pauseGridAutoplay()
- Description:
Pause the grid auto-play.
- Source:
playGridAutoplay()
- Description:
Start the grid auto-play.
- Source:
resetGridDetailsHeight()
- Description:
Reset every grid details panel height and properties previously set.
- Source:
scheduleGridDetailsHeight()
- Description:
Schedule grid details height calculation after layout settles.
- Source:
setGridDetailsHeight()
- Description:
Based on the checks decides whether to apply or reset the grid details height.
- Source:
setGridItem(index)
- Description:
Set the expanded grid item.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
index |
Number | Index of the item to toggle |
Fires:
toggleGridAutoplay(shouldPlay)
- Description:
Toggle the grid auto-play state.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
shouldPlay |
Boolean | Whether auto-play should start |
trigger(eventName, eventData)
- Description:
Trigger a component event.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
eventName |
string | The name of the event to trigger. |
eventData |
any | Data associated with the event. |
(static) autoInit(root) → {StoryCard}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
root |
HTMLElement | DOM element for component instantiation and scope |
Returns:
An instance of StoryCard.
- Type
- StoryCard
Events
onSelection
- Source:
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
index |
number | ||
button |
HTMLElement | ||
details |
HTMLElement |
<nullable> |
Type:
- Object