Show elements in navbar action
Description
The following code shows how to show elements in navbar action.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.1.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<style type='text/css'>
#a, #b {<!--from ww w . j a v a2 s . c o m-->
display: none;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('div[data-role="navbar"] a').live('click', function () {
$(this).addClass('ui-btn-active');
$('div.content_div').hide();
$('div#' + $(this).attr('data-href')).show();
console.log($.mobile.activePage.find('.content_div:visible').attr('id'));
});
});//]]>
</script>
</head>
<body>
<div data-role="page">
<div data-role="content">
<div data-role="navbar">
<ul>
<li><a href="#" data-href="a">One (A)</a></li>
<li><a href="#" data-href="b">Two (B)</a></li>
</ul>
</div>
<!-- /navbar -->
<div id="a" class="content_div">Some 'A' Content</div>
<div id="b" class="content_div">Some 'B' Content</div>
</div>
</div>
</body>
</html>