20
20
* <http://www.gnu.org/licenses/>.
24
* A Toolbar is the JavaScript representation of an Ubuntu HTML5 app <em>footer</em>.
26
######Contained List provides buttons
27
The Toolbar contains a List, where each list item is treated as a Button (see below). List items (Buttons) are pushed to the right. The default Back button always exists to the left and does not need to be declared.
29
#####Default and custom footers
30
See the Pagestack class documentation for information about the default application-wide Footer, customizing it, and adding Page-specific Footers.
35
<footer data-role="footer" class="revealed" id="footerID">
36
<div data-role="list">
39
<a href="#" id="home">Home</a>
46
var toolbar = UI.footer("footerID");
47
UI.button('home').click(function () {
48
UI.pagestack.push("main");
24
53
var Toolbar = function (UbuntuUI, id) {
25
54
this.toolbar = document.getElementById(id);
28
57
Toolbar.prototype = {
29
62
show: function () {
30
63
this.toolbar.classList.add('revealed');
32
69
hide: function () {
33
70
this.toolbar.classList.remove('revealed');
73
* Toggle show/hide status of a Toolbar
35
76
toggle: function () {
36
77
this.toolbar.classList.toggle('revealed');
80
* Provide a callback function that's called with the Toolbar is touched
82
* @param {Function} function - The function that is called when the Toolbar is touched
38
84
touch: function (callback) {
39
85
this.toolbar.addEventListener(UbuntuUI.touchEvents.touchEnd, callback);