Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile (1.1): disable hiding of a fixed navbar

I'm using jQuery Mobile 1.1 and I have a fixed toolbar but I want to disable hiding it when a user clicks somewhere in the page. It would even be better if I can set that up for just specific page elements (like clicking on an input box).

I tried many methods that I found on the web (e.g. $.fixedToolbars.setTouchToggleEnabled(false);) but none of them work, probably because of the 1.1 version. You can check my example here: http://jsfiddle.net/Leqpw/

like image 834
duality_ Avatar asked Mar 28 '12 21:03

duality_


2 Answers

The using is the JQM v 1.0.x method for disabling the fixed toolbar. There are multiple ways to disable this functionality.

The simplest way is to simply add data-tap-toggle="false" to your toolbar. But if you don't feel like copy and pasting a bunch of times in your project try these other methods.

$('[data-position=fixed]').fixedtoolbar({ tapToggle:false});

You can also configure it so that certain elements will ignore this behavior.

$('[data-position=fixed]').fixedtoolbar({ tapToggleBlacklist: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed" })

Update added more info for a more complete answer.

like image 131
codaniel Avatar answered Oct 13 '22 07:10

codaniel


All you need to do is add the following attribute to your header

data-tap-toggle="false"

and the tap toggling will go away.

like image 25
darryn.ten Avatar answered Oct 13 '22 09:10

darryn.ten