Haven't found a solution for changing a custom navbar icon on a page with multiple footers.
That is what I am currently using:
$(".live_menu .ui-icon").css("background","url(/btn_on.gif) !important");
$(".live_menu .ui-icon").css("background-repeat","no-repeat !important");
Any ideas?
Related:
Live Example:
Custom Icons
To use custom icons, specify a data-icon value that has a unique name like myapp-email and the button plugin will generate a class by prefixing ui-icon- to the data-icon value and apply it to the button. You can then write a CSS rule that targets the ui-icon-myapp-email class to specify the icon background source. To maintain visual consistency, create a white icon 18x18 pixels saved as a PNG-8 with alpha transparency.
JS:
$('#custom-li-1').click(function() {
$(this).attr('data-icon','star');
$(this).children().children().next().removeClass('ui-icon-custom').addClass('ui-icon-star');
}).page();
$('#custom-li-2').click(function() {
$(this).attr('data-icon','home');
$(this).children().children().next().removeClass('ui-icon-grid').addClass('ui-icon-home');
}).page();
$('#custom-li-3').click(function() {
$(this).attr('data-icon','grid');
$(this).children().children().next().removeClass('ui-icon-star').addClass('ui-icon-grid');
}).page();
HTML:
<div data-role="page" id="home">
<div data-role="header" data-theme="b">
<h1>Test</h1>
</div>
<div data-role="content" data-theme="d">
<div data-role="navbar" data-theme="d">
<ul id="custom-nav-list">
<li><a href="#" data-icon="custom" class="ui-btn-active" id="custom-li-1">Home</a></li>
<li><a href="#" data-icon="grid" id="custom-li-2">Second page</a></li>
<li><a href="#" data-icon="star" id="custom-li-3">Third page</a></li>
</ul>
</div>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With