new Quiz(element, options)
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
HTMLElement | DOM element for component instantiation and scope |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
Properties
|
Classes
Methods
checkHeight()
destroy()
escapeSlider()
handleClickOnItem(e)
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
Fires:
handleKeyboard()
handleResize()
init()
initSlider()
on(eventName, callback) → {void}
Example
// Registering a callback for the 'toggle' event
quiz.on('onClick', (event) => {
console.log('Click 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
setCounter()
trigger(eventName, eventData)
Parameters:
| Name | Type | Description |
|---|---|---|
eventName |
string | The name of the event to trigger. |
eventData |
any | Data associated with the event. |
(static) autoInit(root) → {Quiz}
Parameters:
| Name | Type | Description |
|---|---|---|
root |
HTMLElement | DOM element for component instantiation and scope |
Returns:
An instance of Quiz.
- Type
- Quiz
Events
onClick
Type:
- Array.<string>