Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <body>
  2. <div data-role="mainview">
  3. <header data-role="header">
  4. <ul data-role="tabs">
  5. <li data-role="tabitem" data-page="main">Main</li>
  6. <li data-role="tabitem" data-page="anotherpage">Another</li>
  7. </ul>
  8. </header>
  9. <div data-role="content">
  10. <div data-role="tab" id="main">
  11. main
  12. </div>
  13. <div data-role="tab" id="anotherpage">
  14. another
  15. </div>
  16. </div>
  17. </div>
  18. </body>
  19.  
  20. <!DOCTYPE html>
  21. <html>
  22. <head>
  23. <meta charset="utf-8">
  24. <title>An Ubuntu HTML5 application</title>
  25. <meta name="description" content="An Ubuntu HTML5 application">
  26. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
  27.  
  28. <!-- Ubuntu UI Style imports - Ambiance theme -->
  29. <link href="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/css/appTemplate.css" rel="stylesheet" type="text/css" />
  30.  
  31. <!-- Ubuntu UI javascript imports - Ambiance theme -->
  32. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/fast-buttons.js"></script>
  33. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/core.js"></script>
  34. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/page.js"></script>
  35. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/pagestacks.js"></script>
  36. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/tabs.js"></script>
  37. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/tab.js"></script>
  38.  
  39. <!-- Cordova platform API access - Uncomment this to have access to the Javascript APIs -->
  40. <!-- <script src="cordova/cordova.js"></script> -->
  41.  
  42. <!-- Application script -->
  43. <script src="js/app.js"></script>
  44. </head>
  45.  
  46. <body>
  47.  
  48. <div data-role="mainview">
  49.  
  50. <header data-role="header">
  51. <ul data-role="tabs">
  52. <li data-role="tabitem" data-page="tab1">Tab 1</li>
  53. <li data-role="tabitem" data-page="tab2">Tab 2</li>
  54. </ul>
  55. </header>
  56.  
  57. <div data-role="content">
  58. <div data-role="tab" id="tab1">
  59. Content of Tab1
  60. </div>
  61.  
  62. <div data-role="tab" id="tab2">
  63. Content of Tab2
  64. </div>
  65. </div>
  66. </div>
  67. </body>
  68. </html>
  69.  
  70. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/tabs.js"></script>
  71. <script src="/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/js/tab.js"></script>
  72.  
  73. // For your tabs
  74. <ul data-role="tabs">
  75. <li data-role="tabitem" data-page="hello-page">Hello World</li>
  76. <li data-role="tabitem" data-page="next-page">Next</li>
  77. </ul>
  78.  
  79. // In your content
  80. <div data-role="tab" id="hello-page">
  81. ...
  82. </div>
  83. <div data-role="tab" id="next-page">
  84. ...
  85. </div>
  86.  
  87. window.onload = function () {
  88. var UI = new UbuntuUI();
  89. UI.init();
  90. [...]
  91.  
  92. // tab workaround code
  93. var tabs = UI.tabs.tabChildren;
  94. for (var i=0; i < tabs.length; i++) {
  95. var tab = tabs[i];
  96. var parent = tab.parentNode;
  97.  
  98.  
  99. tab.addEventListener("click", function() {
  100. var activeNotFound = true;
  101. for (var i=0; i < parent.children.length && activeNotFound; i++) {
  102. var child = parent.children[0];
  103. if (child.getAttribute("class") == "active") {
  104. activeNotFound = false; // found the active element, stop looping
  105. }
  106. else if (child.tagName == "LI" ) {
  107. parent.removeChild(child); // remove child from the front
  108. parent.appendChild(child); // add it to the end
  109. }
  110. }
  111. });
  112. }
  113.  
  114. }
  115.  
  116. <ul data-role="tabs" style="-webkit-transform: none !important;">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement