From a2bfc2749270f1ea3f81af5c1d8bc07a132712ec Mon Sep 17 00:00:00 2001 From: scottjehl Date: Fri, 27 Jan 2012 19:34:14 +0700 Subject: [PATCH] Implemented and documented the tapToggleBlacklist option of the fixedtoolbar plugin, which tells the plugin to ignore certain targets for tap toggling the toolbars. The default list is "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed". --- docs/toolbars/bars-fixed-options.html | 10 ++++++++++ js/jquery.mobile.fixedToolbar.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/toolbars/bars-fixed-options.html b/docs/toolbars/bars-fixed-options.html index 18b9d577..b477ceb7 100755 --- a/docs/toolbars/bars-fixed-options.html +++ b/docs/toolbars/bars-fixed-options.html @@ -84,6 +84,16 @@ $.mobile.fixedToolbars + + +
tapToggleBlacklist string
+
+

default: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed"

+

A list of jQuery selectors that should be ignored for tap-toggling the toolbars.

+
$("[data-role=header]").fixedtoolbar({ tapToggleBlacklist: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed" });
+
+ +
updatePagePadding boolean

default: true

diff --git a/js/jquery.mobile.fixedToolbar.js b/js/jquery.mobile.fixedToolbar.js index 6024330f..e531ed18 100644 --- a/js/jquery.mobile.fixedToolbar.js +++ b/js/jquery.mobile.fixedToolbar.js @@ -14,6 +14,7 @@ define( [ "jquery", "./jquery.mobile.widget", "./jquery.mobile.core", "./jquery. transition: "slide", //can be none, fade, slide (slide maps to slideup or slidedown) fullscreen: false, tapToggle: true, + tapToggleBlacklist: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed", updatePagePadding: true, // Browser detection! Weeee, here we go... @@ -225,7 +226,7 @@ define( [ "jquery", "./jquery.mobile.widget", "./jquery.mobile.core", "./jquery. // tap toggle $el.closest( ".ui-page" ) .bind( "vclick", function( e ){ - if( o.tapToggle && $el.find( e.target ).length === 0 ){ + if( o.tapToggle && !$( e.target ).closest( o.tapToggleBlacklist ).length ){ self.toggle(); } });