All docs
V17.2
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

jQuery ScrollView API

The ScrollView is a widget that enables a user to scroll its content.

import ScrollView from "devextreme/ui/scroll_view"

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the ScrollView widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

jQuery
JavaScript
HTML
$(function() {
    $("#scrollView").dxScrollView({
        height: 500,
        width: 500,
        direction: 'both'
    });
});
<div id="scrollView">
    <div id="content"></div>
</div>
Angular
HTML
TypeScript
<dx-scroll-view
    [height]="500"
    [width]="500"
    direction="both">
        <div id="content"></div>
</dx-scroll-view>
import { DxScrollViewModule } from 'devextreme-angular'
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxScrollViewModule
    ],
    // ...
})
AngularJS
HTML
<div dx-scroll-view="{
    height: 500,
    width: 500,
    direction: 'both'
}">
    <div id="content"></div>
</div>
Knockout
HTML
<div data-bind="dxScrollView: {
    height: 500,
    width: 500,
    direction: 'both'
}">
    <div id="content"></div>
</div>
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().ScrollView()
    .ID("scrollView")
    .Height(500)
    .Width(500)
    .Direction(ScrollDirection.Both)
    .Content(@<text>
        <div id="content"></div>
    </text>)
)
@Code
    Html.DevExtreme().ScrollView() _
        .ID("scrollView") _
        .Height(500) _
        .Width(500) _
        .Direction(ScrollDirection.Both) _
        .Content(Sub()
            @<text>
                <div id="content"></div>
            </text>
        End Sub).Render()
End Code

View Demo

See Also

Configuration

An object defining configuration options for the ScrollView widget.

Name Description
bounceEnabled

A Boolean value specifying whether to enable or disable the bounce-back effect.

direction

A string value specifying the available scrolling directions.

disabled

A Boolean value specifying whether or not the widget can respond to user interaction.

elementAttr

Specifies the attributes to be attached to the widget's root element.

height

Specifies the widget's height.

onDisposing

A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

onInitialized

A handler for the initialized event. Executed only once, after the widget is initialized.

onOptionChanged

A handler for the optionChanged event. Executed after an option of the widget is changed.

onPullDown

A handler for the pullDown event.

onReachBottom

A handler for the reachBottom event.

onScroll

A handler for the scroll event.

onUpdated

A handler for the update event.

pulledDownText

Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold.

pullingDownText

Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold.

reachBottomText

Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom.

refreshingText

Specifies the text shown in the pullDown panel displayed when the content is being refreshed.

rtlEnabled

Switches the widget to a right-to-left representation.

scrollByContent

A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. Applies only if useNative is false

scrollByThumb

A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar.

showScrollbar

Specifies when the widget shows the scrollbar.

useNative

Indicates whether to use native or simulated scrolling.

width

Specifies the widget's width.

Methods

This section describes the members used to manipulate the widget.

Name Description
beginUpdate()

Prevents the widget from refreshing until the endUpdate() method is called.

clientHeight()

Gets the widget's height.

clientWidth()

Gets the widget's width.

content()

Gets the widget's content.

defaultOptions(rule)

Specifies the device-dependent default configuration options for this component.

dispose()

Disposes of all the resources allocated to the ScrollView instance.

element()

Gets the root widget element.

endUpdate()

Refreshes the widget after a call of the beginUpdate() method.

getInstance(element)

Gets the instance of a widget found using its DOM node.

instance()

Gets the widget's instance. Use it to access other methods of the widget.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all widget options.

option(optionName)

Gets the value of a single option.

option(optionName, optionValue)

Updates the value of a single option.

option(options)

Updates the values of several options.

refresh()

Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event.

release(preventScrollBottom)

Notifies the ScrollView that data loading is finished.

scrollBy(distance)

Scrolls the content by a specific distance.

scrollBy(distanceObject)

Scrolls the content by a specific distance in horizontal and vertical directions.

scrollHeight()

Gets the scrollable content's height in pixels.

scrollLeft()

Gets the left scroll offset.

scrollOffset()

Gets the scroll offset.

scrollTo(targetLocation)

Scrolls the content to a specific position.

scrollTo(targetLocationObject)

Scrolls the content to a specific position.

scrollToElement(targetLocation)

Scrolls the content to an element.

scrollTop()

Gets the top scroll offset.

scrollWidth()

Gets the scrollable content's width in pixels.

update()

Updates the scrollable contents' dimensions.

Events

This section describes events fired by this widget.

Name Description
disposing

Raised when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

initialized

Raised only once, after the widget is initialized.

optionChanged

Raised after a widget option is changed.

pullDown

Fires after the widget is scrolled to the top and pulled down.

reachBottom

Fires after the widget is scrolled to the bottom and pulled up.

scroll

Fires on each scroll gesture.

updated

Fires after the widget is updated.

See Also