javascript - JQuery Mobile Menu static on page change -


i'm trying fix top menu on page change. example:

<div data-role="page" id="page1">     //page 1 contents </div> <div data-role="page" id="page2">     //page 2 contents </div> 

and top menu

<div id="top-menu"> </div> 

is there way not make menĂ¹ code reappear on each page? want menu div collective pages.

any ideas?

thanks, andrea

no, concept of "pages" not allow static content shared among them.

but see @ least 2 solutions:

  • use 1 page containing menu, , many hidden div encapsulate content (like <div data-role="content" id="page1" class="hidden">). using menu navigation, have show/hide content need

  • use javascript trickery:

    $(document).on("pagebeforeshow", "[id^=page]", function(event) {     // "move" menu content of current page     // (you have add ids each page 'page1content')     $("#top-menu").prependto("#" + this.id + "content"); }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -