It is up to you to set the
.ui-btn-active class on the active button(s). The specifics depend on your own program logic. It is not a given that there is a single "active" button. You might have one, none, two, or any number. As such, jQuery Mobile can't do it for you.
You need to build whatever logic you need into your template.
I wrote a little one-line helper for the Middleman static site generator that lets me do something like this in a template. (It's a Slim template, BTW, similar to HAML, that's why the inside-out HTML syntax...)
- ul
- li
- a*active('about') href="about.html" ABOUT
- a*active('sponsors') href="sponsors.html" SPONSORS
The "active" helper compares the basename (not including extension) of the file currently being generated with the passed string. If they match, it sets the class
ui-btn-active.
The below won't be useful unless you happen to be using Middleman:
- def active(basename)
- basename ==
- Pathname.new(current_page.destination_path).basename.to_s.sub(/\..*/,'')
- ? {'class' => 'ui-btn-active'} : {}
- end