Displaying content in tabs on Onsen UI page -


i building single page app on onsen ui various pages defined. 1 of pages shows schedule 2 day event , it's logical have tabs dates , respective daily content.

how in onsen ui considering tutorials i've seen on tabs assume main website navigation use tabs not case.

here's code i'd been tinkering with

<ons-template id="schedule.html"> <ons-page>   <ons-toolbar>     <div class="left" style="line-height: 44px">       <ons-back-button>back</ons-back-button>     </div>     <div class="center">schedule</div>   </ons-toolbar>    <div style="text-align: center">         <ons-tabbar  position="top">             <ons-tab page="dayone.html">                 <p>day one</p>             </ons-tab>             <ons-tab page="daytwo.html">                 <p>day two</p>             </ons-tab>         </ons-tabbar>          <ons-tab active="true" page="dayone.html">             <ul class="list">                 <li class="list__item">registration , viewing of exhibition stands</br>8.30 – 9.00am</li>                 <li class="list__item">welcome , introductions<br/>9.00 – 9.10am</li>             </ul>         </ons-tab>         <ons-tab page="daytwo.html">             <ul class="list">                 <li class="list__item">registration , viewing of exhibition stands</br>9.30 – 9.00am</li>                 <li class="list__item">welcome , introductions<br/>9.00 – 9.10am</li>             </ul>         </ons-tab>      <br />     <ons-button modifier="light" onclick="mynavigator.poppage()">       pop page     </ons-button>   </div> </ons-page> 

the usage of tabbar explained here: http://onsen.io/reference/ons-tabbar.html#usage

your pages "dayone.html" , "daytwo.html" should templates or different pages. this:

<ons-page>     <ons-navigator var="mynavigator">         <ons-toolbar>             <div class="center">main page</div>         </ons-toolbar>         <ons-button onclick="mynavigator.pushpage('schedules.html');">go schedules</ons-button>     </ons-navigator> </ons-page>  <ons-template id="schedules.html">     <ons-page>         <ons-tabbar>             <ons-tab page="day1.html" active="true">                 <ons-icon icon="ion-home"></ons-icon>                 <span style="font-size: 14px">day 1</span>             </ons-tab>             <ons-tab page="day2.html">                 <ons-icon icon="ion-star"></ons-icon>                 <span style="font-size: 14px">day 2</span>             </ons-tab>         </ons-tabbar>     </ons-page> </ons-template>  <ons-template id="day1.html">     <ons-page>         <ons-toolbar>             <div class="left"><ons-back-button>back</ons-back-button></div>             <div class="center">day 1 schedule</div>         </ons-toolbar>         <p>day 1 activities here...</p>     </ons-page> </ons-template>  <ons-template id="day2.html">     <ons-page>         <ons-toolbar>             <div class="left"><ons-back-button>back</ons-back-button></div>             <div class="center">day 2 schedule</div>         </ons-toolbar>         <p>day 2 activities here...</p>     </ons-page> </ons-template> 

working example here: http://codepen.io/frankdiox/pen/bnzmpg

hope helps!


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -