The Kendo mobile Application provides the necessary tools for building native-looking web based mobile applications.
The simplest mobile Application consists of a single mobile View.
<body>
<div data-role="view">
<div data-role="header">Header</div>
Hello world!
<div data-role="footer">Footer</div>
</div>
<script>
var app = new kendo.mobile.Application(); //document.body is used by default
</script>
</body>The mobile Application consists of a single HTML page with one or more mobile Views, linked with navigational widgets (Buttons, TabStrip, etc.).
A mobile View is considered each child of the application element (<body> by default) that is decorated with data-role="view".
When initialized, the mobile Application modifies the kendo mobile widgets' behavior so that they navigate between Views when pressed.
The navigation Widget's href attribute specifies the View id to navigate to.
<div data-role="view" id="foo">Foo <a href="#bar" data-role="button">Go to Bar</a></div>
<div data-role="view" id="bar">Bar <a href="#foo" data-role="button">Go to Foo</a></div>By default, all navigational widgets treat the links' hrefs as mobile views. This behavior can be overriden by setting data-rel="external" attribute to the link element.
<a href="http://kendoui.com/" data-rel="external">Visit KendoUI</a>View transitions are defined by setting a data-transition attribute to the View DOM element.
A default View transition may be set using the transition parameter in the options parameter of the Application constructor.
The following transitions are supported:
This is the default iOS View transition. Old View content slides to the left and the new View content slides in its place. Headers and footers (if present) use the fade transition.
The new View (along with its header and footer) content zooms over the previous View. The old View content fades out. Suitable for displaying dialogs.
The new View (along with its header and footer) content fades from the center of the screen, on top of the previous View content.
The new View content slides on top of the previous View. Unlike the slide transition,
the previous View stays "under" the new one, and the headers / footers do not transition separately.
The transition direction can be specified by using overlay:(direction).
Supported directions are down, left, up and right. By default, the direction is left.
<div data-role="view" id="foo" data-transition="slide">Foo <a href="#bar" data-role="button">Go to Bar</a></div>
<div data-role="view" id="bar" data-transition="overlay:up">Bar <a href="#foo" data-role="button">Go to Foo</a></div>When a View transitions to the View displayed before it (foo → bar → foo), this is considered a back navigation.
In this case, the animation of the current View is applied in reverse.
For instance, navigating with slide animation from foo to bar, then back to foo
would cause the foo View to slide from the right side of the screen.
The Kendo mobile Application can load Views remotely by using AJAX. If the navigational widget URL does not start with a hash (#),
the application considers the View to be remote, and issues an AJAX request to the provided URL.
The View content (the first element with data-role="view") are extracted from the AJAX response and appended into the Application element.
Once the remote View is fetched, no additional roundtrips to the server occur when the View is displayed.
<!-- foo.html -->
<div data-role="view">Foo <a href="bar.html" data-role="button">Go to Bar</a></div>
<!-- bar.html -->
<div data-role="view">Bar</div>Navigational widgets can pass additional URL parameters when navigating to Views. The parameters will be available in the show View event.
<a data-role="button" href="#foo?bar=baz">Link to FOO <strong>View</strong> with bar parameter set to baz</a>The Application provides a way to specify the initial view to show. The initial view can be set by passing the view id in the options parameter of the Application's constructor:
<script>
new kendo.mobile.Application($(document.body), {
initial: "ViewID"
});
</script>The mobile devices can create a bookmark with a custom icon, placed on the Home screen. Users can use the shortcut to open that web page later.
<script>
new kendo.mobile.Application($(document.body), {
icon: "URL to a web clip icon"
});
</script>You can also define web clip icons with different sizes. Check this link for more information.
<script>
new kendo.mobile.Application($(document.body), {
icon: {
"72x72" : "URL to a 72 x 72 pixels web clip icon",
"114x114" : "URL to a 114 x 114 pixels web clip icon"
}
});
</script>