使用 jQuery Mobile 在所有页面上保留导航栏 [英] Keep navbar on all pages with jQuery Mobile
问题描述
我目前正在使用 jquery 移动框架创建 phonegap 应用程序.
I'm currently creating phonegap app using jquery mobile framework.
我有多个页面,像这样:
I have multiple pages, like this :
- index.html(全局布局)
- home.html(主页)
- settings.html(设置页面)
- ...
我想在每个页面上都有导航栏,并在每个页面(主页、设置...)上保留它而不重复它,但我不知道为什么我不能这样做(比如 include header.html ?或在全局布局中设置导航栏?).我使用页面之间的链接在我的应用中浏览
I want to have the navbar on every page, and keep it without duplicate it on every page (home, settings...) and I don't know why I can't do that (like include header.html ? or set navbar in global layout ?). I browse in my app using link between pages
<a href="home.html" data-transition="slide">Home</a>
如何保留导航栏?
谢谢,
推荐答案
试试这个帖子,它会为所有页面附加一个共同的页脚,形成一个共同的 html 文件.
Try this post, it appends a common footer to all the pages form a common html file.
$('[data-role=page]').live('pageshow', function (event, ui) {
$("#" + event.target.id).find("[data-role=footer]").load("footer.html", function(){
$("#" + event.target.id).find("[data-role=navbar]").navbar()
});
});
有关更多信息,请参阅这篇文章 - Jquery Mobile 不同页面上的相同页脚
For more info refer this post - Jquery Mobile Same Footer on Different Pages
这篇关于使用 jQuery Mobile 在所有页面上保留导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!