Kendo Mobile - ScrollView

by kendomobile

HTML

<script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.mobile.all.min.css">
<!-- Demo created for the book: Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API.
http://www.packtpub.com/building-mobile-applications-with-kendoui-html5/book -->

<div data-role="view">
    <strong>Current Page Index:  </strong>
    <span  id="output"> 0</span>
    
        <div data-role="scrollview" data-duration="3000"
            data-change="pageChange"
            style="padding-top: 15px;"><div data-role="page">
                <h1>Tip1</h1>                
                In ScrollView, remove all white spaces
            between page HTML elements. Otherwise,
            white spaces will appear as pages in
            the rendered ScrollView.
            </div><div data-role="page">
                <h1>Tip2 </h1>                
                
                You can set the time taken in milliseconds 
            by the ScrollView to settle down the current 
            page after the using the duration property.
            </div><div data-role="page">
                <h1>Tip3 </h1>
                scrollTo() method can be used to navigate
            to a specific page in the ScrollView.
                </div>
    </div>
</div>

CSS

.km-scrollview > div > [data-role=page] {
            /*This is to preserve whitespace. 
             Text will wrap when necessary, and on line breaks*/
            white-space: pre-wrap;
            /*normal can also be used instead of pre-wrap*/
        }

JavaScript

var app = new kendo.mobile.Application(document.body);
        function pageChange(e) {
            //logs the current page number.
            output(e.page);            
        }
        function output(data){
            $("#output").text(data);
            
        }