How to switch through pages using Intel XDK

3.8k views Asked by At

This is my first question, so I hope everything is fine

Here is an easy example HTML using intelXDK App-designer

<div class="uwrap" id="content">
     <div class="upage vertical-col left panel" id="mainpage" data-header="af-header-1" data-footer="af-footer-4">
         <a class="button widget uib_w_4 d-margins" data-uib="app_framework/button" data-ver="1" id="switch">Button</a>
     </div>
     <div class="upage vertical-col left panel" id="timepage" data-header="af-header-2" data-footer="af-footer-5">
         <a class="button widget uib_w_7 d-margins" data-uib="app_framework/button" data-ver="1" id="back">Button</a>
     </div>
</div>
<footer class="wrap-element uib_w_6" data-uib="app_framework/footer" data-ver="1" id="af-footer-5">
    <a class="widget uib_w_8 d-margins icon check" data-uib="app_framework/button" data-ver="1">Button</a>
</footer>
<footer class="wrap-element uib_w_2" data-uib="app_framework/footer" data-ver="1" id="af-footer-4">
    <a class="widget uib_w_3 d-margins icon home" data-uib="app_framework/button" data-ver="1">Button</a>
    <a class="widget uib_w_5 d-margins icon tv" data-uib="app_framework/button" data-ver="1">Button</a>
</footer>

How can I switch between pages? ('mainpage', 'timepage')

$(document).on("click", "#switch", function(evt)
{
     activate_page("#timepage"); 
});

This automatically generated jQuery code doesn't work.

Thanks for your help

3

There are 3 answers

1
aleX On BEST ANSWER

The solution I was looking for is shown below:

$(document).on("click", "#back", function(evt)
{
     //activate_page("#mainpage"); 
     af.ui.loadContent("#mainpage",false,false,"fade");
});
0
moffeltje On

Try this:

$(document).on("click", "#switch", function(evt)
{
      $('html,body').animate({
        scrollTop: $("#timepage").offset().top},
        'slow');
});

Example: http://jsfiddle.net/kevinPHPkevin/8tLdq/1/

0
user2417120 On
  1. Have you import jQuery file? id selector is not working in app_framwork.
  2. You have to set href attribute in your <a>