new FormPages( element, options )

Description

Creates the FormPages component.

Parameters
Name Type Attributes Description
element jQuery

The main form element.

options FormPagesOptions <nullable>
Properties
Name Type Description
$element jQuery

The form which the plugin is constructed upon.

options FormPagesOptions
$formPagesContainer jQuery

The container of the pages

$pages jQuery

The available pages

currentPage number

The current page index, starting on zero.

Details

Methods


trigger( eventName, params )

Description

Makes a proxy and calls events to the main $element object, passing the current page as event data.

Parameters
Name Type Description
eventName string
params object

Params passed to the jQuery trigger function to be attached as event data.

Details

on( eventName, cb, filter )

Description

Configures events to the plugin

Parameters
Name Type Description
eventName string
cb function

Event callback

filter string

See Event Handling

Details

canMoveForwards() → {boolean}

Description

Checks if the pages can move forwards.

Returns
Details

canMoveBackwards() → {boolean}

Description

Checks if the pages can move backwards.

Returns
Details

getTotalPages() → {number}

Description

Checks the amount of the elements that matches to the this.options.formPageClass option value.

Returns
Details

goTo( page ) → {number}

Description

Tries to move the form to a specific page. This also validates if the move is allowed (not out of bounds). In case the component can't move to the desired page, it returns the current page.

Parameters
Name Type Description
page number

the page index - 1

Returns

The current page or the page the component moved to.

Details

goToNextPage() → {number}

Description

Tries to move the form to the next page and returns the current page.

Returns

The page the component moved to or the current page.

Details

goToPrevPage() → {number}

Description

Tries to move the form to the previous page and returns the current page.

Returns

The page the component moved to or the current page.

Details

getParentDimensions() → {Dimensions}

Description

Gets the pages' parent's dimensions.

Returns
Details

getCurrentPageElement() → {jQuery|null}

Description

Gets the active page as jQuery object.

Returns
Details

getPageDimensions( pageNumber ) → {Dimensions}

Description

Gets the dimensions of the page to help adjust possible animations.

Parameters
Name Type Description
pageNumber number
Returns
Details