PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/toolbars/bars-fixed-options.html

https://github.com/jjoe64/jquery-mobile
HTML | 177 lines | 132 code | 45 blank | 0 comment | 0 complexity | 5573d4b48a92b7c11df67b8598d25b81 MD5 | raw file
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>jQuery Mobile Framework - Fixed Toolbars</title>
  7. <link rel="stylesheet" href="../../css/themes/default/jquery.mobile.css" />
  8. <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
  9. <script src="../../js/jquery.js"></script>
  10. <script src="../../docs/_assets/js/jqm-docs.js"></script>
  11. <script src="../../js/"></script>
  12. </head>
  13. <body>
  14. <div data-role="page" class="type-interior">
  15. <div data-role="header" data-position="fixed" data-theme="f">
  16. <h1>Fixed toolbars</h1>
  17. <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
  18. <a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
  19. </div>
  20. <div data-role="content">
  21. <div class="content-primary">
  22. <h2>Fixed toolbars</h2>
  23. <ul data-role="controlgroup" data-type="horizontal" class="localnav">
  24. <li><a href="bars-fixed.html" data-role="button" data-transition="fade">Basics</a></li>
  25. <li><a href="bars-fixed-options.html" data-role="button" data-transition="fade" class="ui-btn-active">Options</a></li>
  26. <li><a href="bars-fixed-methods.html" data-role="button" data-transition="fade">Methods</a></li>
  27. <li><a href="bars-fixed-events.html" data-role="button" data-transition="fade">Events</a></li>
  28. </ul>
  29. <p>The fixedtoolbar plugin has the following options:</p>
  30. <dl>
  31. <dt><code>visibleOnPageShow</code> <em>boolean</em></dt>
  32. <dd>
  33. <p class="default">default: true</p>
  34. <p>This determines whether the toolbar is visible or not when its parent page is shown. This option is also exposed as a data attribute: <code>data-visible-on-page-show=&quot;false&quot;</code></p>
  35. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ visibleOnPageShow: false }</strong>);</code></pre>
  36. </dd>
  37. <dt><code>disablePageZoom</code> <em>boolean</em></dt>
  38. <dd>
  39. <p class="default">default: true</p>
  40. <p>This determines whether user-scaling should be disabled on pages that contain fixed toolbars. This option is also exposed as a data attribute: <code>data-disable-page-zoom=&quot;false&quot;</code></p>
  41. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ disablePageZoom: false }</strong>);</code></pre>
  42. </dd>
  43. <dt><code>transition</code> <em>string</em></dt>
  44. <dd>
  45. <p class="default">default: "slide" (which ends up using slideup and slidedown)</p>
  46. <p>The transition that should be used for showing and hiding a fixed toolbar. Possible values are "none", "fade", and "slide" (or you can write a CSS transition of your own and use that too). This option is also exposed as a data attribute: <code>data-transition=&quot;fade&quot;</code></p>
  47. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ transition: "fade" }</strong>);</code></pre>
  48. </dd>
  49. <dt><code>fullscreen</code> <em>boolean</em></dt>
  50. <dd>
  51. <p class="default">default: false</p>
  52. <p>Fullscreen fixed toolbars sit on top of the content at all times when they are visible, and unlike regular fixed toolbars, fullscreen toolbars do not fall back to static positioning when toggled, instead they disappear from the screen entirely. Fullscreen toolbars are ideal for more immersive interfaces, like a photo viewer that is meant to fill the entire screen with the photo itself and no distractions. <a href="bars-fullscreen.html">This page</a> demonstrates toolbars that use the fullscreen option. This option is also exposed as a data attribute: <code>data-fullscreen=&quot;true&quot;</code></p>
  53. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ fullscreen: true }</strong>);</code></pre>
  54. <p class="ui-body ui-body-e"><strong>Note:</strong>While the data-attribute syntax for this option has not changed, it is now only supported on the toolbar element itself, and not the page element. </p>
  55. </dd>
  56. <dt><code>tapToggle</code> <em>boolean</em></dt>
  57. <dd>
  58. <p class="default">default: true</p>
  59. <p>Enable or disable the user's ability to toggle toolbar visibility with a tap on the screen (or a click, for mouse users). This option is also exposed as a data attribute: <code>data-tap-toggle=&quot;true&quot;</code></p>
  60. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ tapToggle: true }</strong>);</code></pre>
  61. <div class="ui-body ui-body-e">
  62. <p><strong>Note:</strong> This behavior was formerly configurable as follows, but as of version 1.1 this syntax is no longer supported:
  63. <pre><code>
  64. $.mobile.fixedToolbars
  65. .setTouchToggleEnabled(false);
  66. </code></pre>
  67. </div>
  68. </dd>
  69. <dt><code>tapToggleBlacklist</code> <em>string</em></dt>
  70. <dd>
  71. <p class="default">default: "a, .ui-header-fixed, .ui-footer-fixed"</p>
  72. <p>A list of jQuery selectors that, when tapped, will not cause the toolbars to be toggled.</p>
  73. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ tapToggleBlacklist: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed" }</strong>);</code></pre>
  74. </dd>
  75. <dt><code>hideDuringFocus</code> <em>string</em></dt>
  76. <dd>
  77. <p class="default">default: "input, select, textarea"</p>
  78. <p>A list of jQuery selectors that should cause the toolbars to hide while focused, except if they are in a fixed toolbar.</p>
  79. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ hideDuringFocus: "input, select, textarea" }</strong>);</code></pre>
  80. </dd>
  81. <dt><code>updatePagePadding</code> <em>boolean</em></dt>
  82. <dd>
  83. <p class="default">default: true</p>
  84. <p>Since toolbars can vary in height depending on the content they contain, this option automatically updates the padding on the page element to ensure that fixed toolbars have adequate space in the document when they are statically positioned, and when scrolled to the top or bottom of the page. When enabled, the padding updates during many operations, such as pageshow, during page transitions, and on resize and orientationchange. As an optimization, we would recommend that you consider disabling this option and adding a rule to your CSS to set the padding of the page div to match the EM height of your toolbars, such as <code>.ui-page-header-fixed { padding-top: 4.5em; }</code>. This option is also exposed as a data attribute: <code>data-update-page-paddinge=&quot;false&quot;</code></p>
  85. <pre><code>$("[data-role=header]").fixedtoolbar(<strong>{ updatePagePadding: false }</strong>);</code></pre>
  86. </dd>
  87. <dt><code>supportBlacklist</code> <em>function</em></dt>
  88. <dd>
  89. <p class="default">default: function that returns a boolean value</p>
  90. <p>CSS <code>position: fixed</code> support is very difficult to test; in fact, at the time of version 1.1 release, there was no known way to reasonably test for fixed support without turning up false positives or negatives in certain popular browsers. This option is a function that attempts to opt-out some popular platforms that are known to be troublesome with <code>position: fixed</code> . Often, these platforms support <code>position: fixed</code> partially, which can be worse than not supporting it at all. If overriding this option with your own blacklist logic, you simply need to provide a function that returns a true or false result when called upon initialization. You must set it on mobileinit, so that it applies when the plugin is initially created.</p>
  91. <pre><code>
  92. $( document ).bind("mobileinit", function(){
  93. $.mobile.fixedtoolbar.prototype.options.supportBlacklist = function(){
  94. var result;
  95. // logic to determine whether result should be true or false
  96. return result;
  97. };
  98. })</code></pre>
  99. </dd>
  100. <dt><code>initSelector</code> <em>CSS selector string</em></dt>
  101. <dd>
  102. <p class="default">default: ":jqmData(position='fixed')"</p>
  103. <p>This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as fixed toolbars. To change which elements are initialized, bind this option to the <a href="../api/globalconfig.html">mobileinit event</a>:</p>
  104. <pre><code>$( document ).bind( "mobileinit", function(){
  105. <strong>$.mobile.fixedtoolbar.prototype.options.initSelector = ".myselector";</strong>
  106. });
  107. </code></pre>
  108. </dd>
  109. </dl>
  110. </div><!--/content-primary -->
  111. <div class="content-secondary">
  112. <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
  113. <h3>More in this section</h3>
  114. <ul data-role="listview" data-theme="c" data-dividertheme="d">
  115. <li data-role="list-divider">Toolbars</li>
  116. <li><a href="docs-bars.html">Toolbar basics</a></li>
  117. <li><a href="docs-headers.html">Header bars</a></li>
  118. <li><a href="docs-footers.html">Footer bars</a></li>
  119. <li><a href="docs-navbar.html">Navbars</a></li>
  120. <li data-theme="a"><a href="bars-fixed.html">Fixed positioning</a></li>
  121. <li><a href="footer-persist-a.html">Persistent toolbars</a></li>
  122. <li><a href="bars-themes.html">Theming toolbars</a></li>
  123. </ul>
  124. </div>
  125. </div>
  126. </div><!-- /content -->
  127. <div data-role="footer" class="footer-docs" data-theme="a" data-position="fixed">
  128. <h1>Fixed Footer</h1>
  129. </div>
  130. </div><!-- /page -->
  131. </body>
  132. </html>