我試圖實現一些代碼,這些代碼將在我的所有網頁上創建頁眉和頁腳,而不是硬編碼它們。我試過這個:jQuery Mobile:爲所有頁面使用相同的頁眉頁腳
我在我的「主頁」中有過這個,我只是打包了我想要的div的頭文件。
<div id="headerProto">
<div data-role="header" data-position="fixed" data-theme="b">
<h1> Title </h1>
</div>
</div>
然後在其他頁面我有:
<div class="headerChild">
</div>
我說:
$(".headerChild").html($("#headerProto").html());
沒有骰子。無論哪種方式,這都是我應該如何去做的總猜測。有沒有更好的辦法?
你無法使用像PHP動態服務器端語言生成這些頁面?那將是最好的方法。 – Brandan 2012-03-08 16:14:11
http://stackoverflow.com/questions/9152446/creating-templated-persistant-header-footer-template-in-jquery-mobile-and-phoneg/9204896#9204896 – bmurmistro 2012-03-08 17:15:52