[SOLVED] Routed page behind main page

I have this code:

  <div id="app">
    <a href="#" class="button " onclick="mypopup();" >Open Popup</a>
    <div id="mypopupdiv"></div>
  function  mypopup(){
    var data = ''+
    '<div class="page">'+
    '  <div class="view view-left">'+
    '    <div class="page-content">'+
    '      <div class="list">'+
    '        <ul>'+
    '          <li><a href="#" onclick="openpage(1);" class="item-link item-content"><div class="item-inner"><div class="item-title">Page A</div></div></a></li>'+
    '          <li><a href="#" onclick="openpage(2);" class="item-link item-content"><div class="item-inner"><div class="item-title">page B</div></div></a></li>'+
    '        </ul>'+
    '      </div>'+
    '    </div>'+
    '  </div>'+    
    document.getElementById("mypopupdiv").innerHTML = data;
    popup_View = app.views.create('.view-left', {url: '/'});  

  function      openpage(page){
    if (page===1){
    if (page===2){

and routed page is opened “behind” main page, it looks like this:

why is that? If I put z-index=10000 on routed page, it is displayed in front but in that case, Back link does not work? Is there any example of using one view alone, dynamically created from JavaScript?
Thank you

Would be good to see live example or JSFiddle, it is not clear how and where do you call this code and what you are trying to achieve

Also the app layout you have is wrong, check the docs http://framework7.io/docs/app-layout.html

I even can not create working JsFiddle, but you will see what I mean. My try is here:
Basically, I need that view is created dynamically inside DIV and that I can navigate between simple pages.

Here is JSFiddle which display what I need: https://jsfiddle.net/bp2ug9co/3/
With other words, when I put all HTML there where is “mydiv”, 2 links is displayed.
When I want to put same content using document.getElementById(“mydiv”).innerHTML = data;, it does not work (content is not displayed. (inside “data” is same content).
Thank you

OK I solved it like this: I create whole layout inside HTML and using innerHTML, I just put needed content, not all.

1 Like