Hi to all.
I’m really new to Framework7 and I’m trying to build a simple application.
Currently, i’ve created a simple app page with:
<div id="app" class="framework7-root">
<div class="statusbar"></div>
<div class="view view-main">
<!-- Initial Page, "data-name" contains page name -->
<div data-name="home" class="page page-current">
<!-- Top Navbar -->
<div class="navbar">
<div class="navbar-inner">
<div class="title">Page Home Title</div>
</div>
</div>
<!-- Scrollable page content -->
<div class="page-content ptr-content ptr-transitioning" data-ptr-distance="55">
This is page content for "page-home"
</div>
</div>
</div>
</div>
Now, when I click on a like, a new page is added after page home. Doing so will result in two pages at the same time in the dom.
this would be ok, but as I’m using some templates, I can’t simply use:
$$('script.template').html();
because i would have multiple “” in the same dom.
Currently, I use some script on pageInit event, bound to each page, something like this:
app.on('pageInit', function(page) {
if ( page.name == '' ) onHomeInit(page);
if ( page.name == 'order' ) onOrderInit(page);
});
the question is: are multiple pages in DOM at the same time an expected behaviour or am I miss something?
How can I refer to the current active page without prefixing everything with the selector “’.page[data-name=“order”]” or without putting unique IDs everywhere?