I have a JQuery Mobile application that I'm working on. In this application, I have a page that uses a Navbar in the footer (http://jquerymobile.com/demos/1.1.0-rc.1/docs/toolbars/docs-navbar.html). This Navbar has three buttons.

For some reason, the first time that I navigate to the page, the buttons show the default plus sign. However, if I refresh the page, or navigate via one of the other buttons in the footer, the icons that I have set appear as desired. How do I make it so that the navbar always shows the icons I have specified? Here is the code associated with my first page:

<style type="text/css">
  .navbar .ui-btn .ui-btn-inner { padding-top: 40px !important; }
  .navbar .ui-btn .ui-icon { width: 30px!important; height: 30px!important; margin-left: -15px !important; box-shadow: none!important; -moz-box-shadow: none!important; -webkit-box-shadow: none!important; -webkit-border-radius: 0 !important; border-radius: 0 !important; }                

  #tab1 .ui-icon { background: url(/images/tab1.png) 50% 50% no-repeat; background-size: 24px 22px; }
  #tab2 .ui-icon { background: url(/images/tab2.png) 50% 50% no-repeat; background-size: 24px 22px; }       
  #tab3 .ui-icon { background: url(/images/tab3.png) 50% 50% no-repeat; background-size: 24px 22px; }       

</style>

<div id="tabsPage" data-role="page">
  <div data-role="header">
  </div>

  <div data-role="footer" class="navbar">
    <div data-role="navbar" class="navbar" data-grid="d">
      <ul>
        <li><a href="#" id="tab1" data-icon="custom" class="ui-btn-active">Tab 1</a></li>
        <li><a href="/tab2" id="tab2" data-icon="custom" rel="external" defaultPageTransition="none">Tab 2</a></li>
        <li><a href="/tab3" id="tab3" data-icon="custom" rel="external" defaultPageTransition="none">Tab 3</a></li>
      </ul>   
    </div>
  </div>
</div>
有帮助吗?

解决方案

Try making the image links absolute paths.

其他提示

I'm not sure, but maybe add to your href

class="ui-icon"?

At the moment, your CSS targets a class of UI Icon within a id of tab3, either take out the .ui-icon or add it as a class in your href.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top