API Docs for: 0.8.6
Show:

NanoScroll Class

Constructor

NanoScroll

(
  • element
  • options
)

Parameters:

  • element HTMLElement | Node

    the main element

  • options Object

    nanoScroller's options

Methods

addEvents

() private

Adds event listeners with jQuery.

createEvents

() private

Creates event related methods

destroy

() chainable

Destroys nanoScroller and restores browser's native scrollbar.

Example:

$(".nano").nanoScroller({ destroy: true });

flash

() chainable

To flash the scrollbar gadget for an amount of time defined in plugin settings (defaults to 1,5s). Useful if you want to show the user (e.g. on pageload) that there is more content waiting for him.

Example:

$(".nano").nanoScroller({ flash: true });

generate

() private chainable

Generates nanoScroller's scrollbar and elements for it.

getBrowserScrollbarWidth

() Number private static

Returns browser's native scrollbar width

Returns:

Number:

the scrollbar width in pixels

nativeScrolling

() private

Enable iOS native scrolling

preventScrolling

(
  • event
  • direction
)
private

Prevents the rest of the page being scrolled when user scrolls the .nano-content element.

Parameters:

  • event Event
  • direction String

    Scroll direction (up or down)

removeEvents

() private

Removes event listeners with jQuery.

reset

() chainable

Resets nanoScroller's scrollbar.

Example:

$(".nano").nanoScroller();

restore

() private

scroll

() private

Example:

$(".nano").nanoScroller({ scroll: 'top' });

scrollBottom

(
  • offsetY
)
chainable

Scroll at the bottom with an offset value

Parameters:

  • offsetY Number

Example:

$(".nano").nanoScroller({ scrollBottom: value });

scrollTo

(
  • node
)
chainable

Scroll to an element

Parameters:

  • node Node

    A node to scroll to.

Example:

$(".nano").nanoScroller({ scrollTo: $('#a_node') });

scrollTop

(
  • offsetY
)
chainable

Scroll at the top with an offset value

Parameters:

  • offsetY Number

Example:

$(".nano").nanoScroller({ scrollTop: value });

setOnScrollStyles

() private

Updates CSS styles for current scroll position. Uses CSS 2d transfroms and window.requestAnimationFrame if available.

stop

() chainable

To stop the operation. This option will tell the plugin to disable all event bindings and hide the gadget scrollbar from the UI.

Example:

$(".nano").nanoScroller({ stop: true });

updateScrollValues

() private

Updates those nanoScroller properties that are related to current scrollbar position.

Properties

alwaysVisible

Boolean

a setting to make the scrollbar always visible.

Default: false

BROWSER_IS_IE7

Boolean private final static

BROWSER_SCROLLBAR_WIDTH

Number private static

Default: null

contentClass

String

a classname for the content element.

Default: 'nano-content'

disableResize

Boolean

a setting to disable binding to the resize event.

Default: false

documentContext

Document

an alternate document context.

Default: null

DOMSCROLL

String private final static

DOWN

String private final static

DRAG

String private final static

ENTER

String private final static

flashDelay

Number

a default timeout for the flash() method.

Default: 1500

iOSNativeScrolling

Boolean

a setting to enable native scrolling in iOS devices.

Default: false

KEYDOWN

String private final static

KEYUP

String private final static

MOUSEDOWN

String private final

MOUSEENTER

String private final

MOUSEMOVE

String private final static

MOUSEUP

String private final static

MOUSEWHEEL

String private final

paneClass

String

a classname for the pane element.

Default: 'nano-pane'

PANEDOWN

String private final static

preventPageScrolling

Boolean

a setting to prevent the rest of the page being scrolled when user scrolls the .content element.

Default: false

RESIZE

String private final

SCROLL

String private final static

SCROLLBAR

String private final static

sliderClass

String

a classname for the slider element.

Default: 'nano-slider'

sliderMaxHeight

Number

a maximum height for the .slider element.

Default: null

sliderMinHeight

Number

a minimum height for the .slider element.

Default: 20

TOUCHMOVE

String private final static

UP

String private final static

WHEEL

String private final static

windowContext

Window

an alternate window context.

Default: null