jQuery Mobile Reusing a Header and Navigation

后端 未结 1 1410
天命终不由人
天命终不由人 2020-12-02 02:07

I\'m new to jQuery Mobile and have having issues understanding reusing a header and general navigation.

So I\'ve created a header which has a menu button on the righ

1条回答
  •  有刺的猬
    2020-12-02 02:23

    You can use External Header and Popup and have them accessible from any page.

    Place both div separately inside body not inside any other page. Make sure you don't wrap Popup div in any other div/container but body.

    
      

    Since both are External widgets, you need to initialize them manually. Call .toolbar() to initialize Header, and .popup() to initialize Popup. If Popup contains other jQM widgets e.g. listview, you need to call .enhanceWithin() to initialize widgets inside Popup. just add the below code in head.

    $(function () {
       $("[data-role=header]").toolbar(); /* initialize header */
       $("[data-role=popup]").popup().enhanceWithin(); /* initialize popup */
    });
    

    Demo

    0 讨论(0)
提交回复
热议问题