Interface JScrollPaneApi

Index

Methods

Methods

public animate(ele: JQuery, prop: string, value: any, stepCallback: (...args: any[]) => any)

This method is called when jScrollPane is trying to animate to a new position. You can override it if you want to provide advanced animation functionality.

Parameters

  • ele: JQuery
  • prop: string
  • value: any
  • stepCallback: (...args: any[]) => any

public destroy()

Destroys the jScrollPane on the instance matching this API object and restores the browser's default behaviour.

public getContentHeight(): number

Returns the height of the content within the scroll pane.

Returns

number

public getContentPane(): JQuery

Gets a reference to the content pane. It is important that you use this method if you want to edit the content of your jScrollPane as if you access the element directly then you may have some problems (as your original element has had additional elements for the scrollbars etc added into it).

Returns

JQuery

public getContentPositionX(): number

Returns the current x position of the viewport with regards to the content pane.

Returns

number

public getContentPositionY(): number

Returns the current y position of the viewport with regards to the content pane.

Returns

number

public getContentWidth(): number

Returns the width of the content within the scroll pane.

Returns

number

public getIsScrollableH(): boolean

Returns whether or not this scrollpane has a horizontal scrollbar.

Returns

boolean

public getIsScrollableV(): boolean

Returns whether or not this scrollpane has a vertical scrollbar.

Returns

boolean

public getPercentScrolledX(): number

Returns the horizontal position of the viewport within the pane content.

Returns

number

public getPercentScrolledY(): number

Returns the vertical position of the viewport within the pane content.

Returns

number

public hijackInternalLinks()

Hijacks the links on the page which link to content inside the scrollpane. If you have changed the content of your page (e.g. via AJAX) and want to make sure any new anchor links to the contents of your scroll pane will work then call this function.

public positionDragX(x: number, animate?: boolean)

Positions the horizontal drag at the specified x position (and updates the viewport to reflect this)

Parameters

  • x: number

    New position of the horizontal drag

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public positionDragY(y: number, animate?: boolean)

Positions the vertical drag at the specified y position (and updates the viewport to reflect this)

Parameters

  • y: number
  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public reinitialise(options?: JScrollPaneSettings)

Reinitialises the scroll pane (if it's internal dimensions have changed since the last time it was initialised). The settings object which is passed in will override any settings from the previous time it was initialised - if you don't pass any settings then the ones from the previous initialisation will be used.

Parameters

public scrollBy(deltaX: number, deltaY: number, animate?: boolean)

Scrolls the pane by the specified amount of pixels.

Parameters

  • deltaX: number

    Number of pixels to scroll horizontally

  • deltaY: number

    Number of pixels to scroll vertically

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollByX(deltaX: number, animate?: boolean)

Scrolls the pane by the specified amount of pixels.

Parameters

  • deltaX: number

    Number of pixels to scroll horizontally

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollByY(deltaY: number, animate?: boolean)

Scrolls the pane by the specified amount of pixels

Parameters

  • deltaY: number

    Number of pixels to scroll vertically

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollTo(destX: number, destY: number, animate?: boolean)

Scrolls the pane so that the specified co-ordinates within the content are at the top left of the viewport.

Parameters

  • destX: number

    Left position of the viewport to scroll to

  • destY: number

    Top position of the viewport to scroll to

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToBottom(animate?: boolean): any

Scrolls this jScrollPane down as far as it can currently scroll.

Parameters

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

Returns

any

public scrollToElement(ele: JQuery, stickToTop?: boolean, animate?: boolean)

Scrolls the specified element (a jQuery object) into view so that it can be seen within the viewport.

Parameters

  • ele: JQuery

    A jQuery object to scroll to

  • stickToTop?: boolean optional

    If it is true then the element will appear at the top of the viewport, if it is false then the viewport will scroll as little as possible to show the element.

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToElement(ele: string, stickToTop?: boolean, animate?: boolean)

Scrolls the specified element (a jQuery selector string) into view so that it can be seen within the viewport.

Parameters

  • ele: string

    A jQuery selector of the object to scroll to

  • stickToTop?: boolean optional

    If it is true then the element will appear at the top of the viewport, if it is false then the viewport will scroll as little as possible to show the element.

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToElement(ele: HTMLElement, stickToTop?: boolean, animate?: boolean)

Scrolls the specified element (a DOM node) into view so that it can be seen within the viewport.

Parameters

  • ele: HTMLElement

    A DOM node to scroll to

  • stickToTop?: boolean optional

    If it is true then the element will appear at the top of the viewport, if it is false then the viewport will scroll as little as possible to show the element.

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToPercentX(destPercentX: number, animate?: boolean)

Scrolls the pane to the specified percentage of its maximum horizontal scroll position.

Parameters

  • destPercentX: number

    Percentage from left of the full width of the viewport to scroll to

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToPercentY(destPercentY: number, animate?: boolean)

Scrolls the pane to the specified percentage of its maximum vertical scroll position.

Parameters

  • destPercentY: number

    Percentage from top of the full width of the viewport to scroll to

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToX(destX: number, animate?: boolean)

Scrolls the pane so that the specified co-ordinate within the content is at the left of the viewport.

Parameters

  • destX: number

    Left position of the viewport to scroll to

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.

public scrollToY(destY: number, animate?: boolean)

Scrolls the pane so that the specified co-ordinate within the content is at the top of the viewport.

Parameters

  • destY: number

    Top position of the viewport to scroll to

  • animate?: boolean optional

    Should an animation occur. If you don't provide this argument then the animateScroll value from the settings object is used instead.