Creating templated/persistant header/footer template in jQuery Mobile and PhoneGap

后端 未结 6 500
傲寒
傲寒 2020-12-02 07:27

I\'m diving into writing a mobile app with jQuery Mobile/PhoneGap. I\'m using this sample template to start from, which uses HTML/JS to create the pages. Rather than have al

6条回答
  •  不思量自难忘°
    2020-12-02 07:58

    Something like this:

    function getText() {
        //return footer text here
    }
    
    
    $("div:jqmData(role='page')").live("pagebeforecreate",function() {
        // get find the footer of the page
        var $footer =$(this).page().find('div:jqmData(role="footer")')
        // insert it where you want it... 
    }
    

    you could just define the role=footer in the getText and just check to see if it's defined... if not then add it.

提交回复
热议问题