Function
Static Public Summary | ||
public |
belt(glider: Element, opts: PRESET_DEFAULTS): function Belt animation slider. |
|
public |
coverLeft(glider: Element, opts: PRESET_DEFAULTS): function Cover left animation slider |
|
public |
coverLeftRight(glider: Element, opts: PRESET_DEFAULTS): function Cover left/right animation slider |
|
public |
coverRight(glider: Element, opts: PRESET_DEFAULTS): function Cover right animation slider |
|
public |
dataWrapper(glider: Element, opts: DATA_DEFAULTS): function Wraps Paraglider to apply pagers and navigation buttons and autoplay. |
|
public |
multiBelt(glider: Element, opts: PRESET_DEFAULTS): function Belt animation slider. |
|
public |
multiWrapper(glider: Element, opts: PRESET_DEFAULTS): function Wrapper including navigation arrows. |
|
public |
wrapper(glider: Element, opts: PRESET_DEFAULTS): function Simple wrapper including pagers and navigation arrows. |
Static Private Summary | ||
private |
animate(speed: integer, from: number, to: number, callback: animationCallback): function Animates from one value to the other over a given time. |
|
private |
arrayOrValue(arr: array): any Takes an array and returns a single value if it is the only item. |
|
private |
eitherOr(either: any, or: any): any Returns either the first or second value depending on truthness. |
|
private |
Helper to get elements. |
|
private |
Helper to get elements. |
|
private |
A loop using modulo |
|
private |
parseObject(dataset: dataset): object Parse dataset with nested object strings to a true object |
|
private |
preventDefault(e: Event) Prevents default event |
|
private |
toggleClass(el: Element, className: string, bool: boolean) Toggle class ponyFill to support IE11 and other awkward browsers. |
version [version] |
Static Public
public belt(glider: Element, opts: PRESET_DEFAULTS): function source
import belt from 'paraglider/src/presets/belt.js'
Belt animation slider.
This is a default slider that moves the current and next or previous slide at the same time. The movement is linear.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public coverLeft(glider: Element, opts: PRESET_DEFAULTS): function source
import coverLeft from 'paraglider/src/presets/cover-left.js'
Cover left animation slider
This is a slider that moves the next or previous over the current slide. The movement is linear. Sides always cover from left.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public coverLeftRight(glider: Element, opts: PRESET_DEFAULTS): function source
import coverLeftRight from 'paraglider/src/presets/cover-left-right.js'
Cover left/right animation slider
This is a slider that moves the next or previous over the current slide. The movement is linear. Sides cover from left and right
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public coverRight(glider: Element, opts: PRESET_DEFAULTS): function source
import coverRight from 'paraglider/src/presets/cover-right.js'
Cover right animation slider
This is a slider that moves the next or previous over the current slide. The movement is linear. Sides always cover from right.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public dataWrapper(glider: Element, opts: DATA_DEFAULTS): function source
import dataWrapper from 'paraglider/src/presets/data-wrapper.js'
Wraps Paraglider to apply pagers and navigation buttons and autoplay. This wrapper simplifies the usage of Paraglider by offering some basic functionality. Data attributes are used to configure the plugin.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | DATA_DEFAULTS |
public multiBelt(glider: Element, opts: PRESET_DEFAULTS): function source
import multiBelt from 'paraglider/src/presets/multi-belt.js'
Belt animation slider.
This is a default slider that moves the current and next or previous slide at the same time. The movement is linear.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public multiWrapper(glider: Element, opts: PRESET_DEFAULTS): function source
import multiWrapper from 'paraglider/src/presets/multi-wrapper.js'
Wrapper including navigation arrows.
Allows using visibleSlides
& slideBy
options
Use this helper to create custom sliders with arrows, to navigate to different slides. The options are extended by additional class names.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
public wrapper(glider: Element, opts: PRESET_DEFAULTS): function source
import wrapper from 'paraglider/src/presets/wrapper.js'
Simple wrapper including pagers and navigation arrows.
Use this helper to create custom sliders with pager dots and arrows, to navigate to different slides. The options are extended by additional class names.
Params:
Name | Type | Attribute | Description |
glider | Element | ||
opts | PRESET_DEFAULTS |
Static Private
private animate(speed: integer, from: number, to: number, callback: animationCallback): function source
import {animate} from 'paraglider/src/helpers.js'
Animates from one value to the other over a given time. This function uses requestAnimationFrame and Date to return a reliable result.
Params:
Name | Type | Attribute | Description |
speed | integer | Duration of animation |
|
from | number | Starting point |
|
to | number | End point |
|
callback | animationCallback | Callback to be run on every step. |
private arrayOrValue(arr: array): any source
import {arrayOrValue} from 'paraglider/src/helpers.js'
Takes an array and returns a single value if it is the only item. Otherwise it returns the original array.
Params:
Name | Type | Attribute | Description |
arr | array | Array to check |
Return:
any (nullable: true) |
Example:
arrayOrValue([null, 1, 2]) // => [null, 1, 2]
arrayOrValue([1]) // => 1
arrayOrValue(['a']) // => 'a'
arrayOrValue([1,'1']) // => [1,'1']
arrayOrValue([null]) // => null
private eitherOr(either: any, or: any): any source
import {eitherOr} from 'paraglider/src/helpers.js'
Returns either the first or second value depending on truthness. Any number is considered true.
Params:
Name | Type | Attribute | Description |
either | any | ||
or | any |
Return:
any | One of the two input values |
Example:
eiterOr(0, 4) // => 0
eiterOr('0', 4) // => '0'
eiterOr('foo', 4) // => 'foo'
eiterOr('', 4) // => 4
eiterOr(false, 4) // => 4
eiterOr(undefined, 4) // => 4
eiterOr(null, 4) // => 4
eiterOr({}, 4) // => {}
eiterOr([], 4) // => []
eiterOr(() => {}, 4) // => () => {}
private findAll(selector: string, context: Element): array source
import {findAll} from 'paraglider/src/helpers.js'
Helper to get elements. Similar to jQuery's $(selector, context)
Return:
array | A list of matching elements |
Example:
findAll('.foo') // => [...]
private findFirst(selector: string, context: Element): Element source
import {findFirst} from 'paraglider/src/helpers.js'
Helper to get elements. Similar to jQuery's $(selector, context)[0]
Example:
findFirst('.foo') // => <div .../>
private modLoop(current: number, addition: number, length: number): number source
import {modLoop} from 'paraglider/src/helpers.js'
A loop using modulo
Example:
modLoop(1, 2, 3) // => 0
modLoop(2, 3, 4) // => 1
modLoop(2, -3, 4) // => 3
modLoop(20, -3, 20) // => 17
modLoop(20, -30, 20) // => 10
private parseObject(dataset: dataset): object source
import {parseObject} from 'paraglider/src/helpers.js'
Parse dataset with nested object strings to a true object
Params:
Name | Type | Attribute | Description |
dataset | dataset |
Example:
const data = parseObject(document.querySelector('.foo').dataset)
private preventDefault(e: Event) source
import {preventDefault} from 'paraglider/src/helpers.js'
Prevents default event
Params:
Name | Type | Attribute | Description |
e | Event |
Example:
el.addEventListener('mousemove', preventDefault)
el.addEventListener('dragstart', e => {
preventDefault(e)
// ...
})
private toggleClass(el: Element, className: string, bool: boolean) version [version] source
import {toggleClass} from 'paraglider/src/helpers.js'
Toggle class ponyFill to support IE11 and other awkward browsers.
IE11 can't use a second argument in element.classList.toggle
Example:
const element = document.querySelector('a')
const isActive = true
toggle(element, active, isActive) // add active
toggle(element, active, 1) // add active
toggle(element, active, !0) // add active
toggle(element, active, !!1) // add active
toggle(element, active, 'yes') // add active
toggle(element, active, 'no') // add active
toggle(element, active, null) // toggle active
toggle(element, active) // toggle active
toggle(element, active, false) // remove active
toggle(element, active, 0) // remove active
toggle(element, active, !!0) // remove active
toggle(element, active, '') // remove active