Ora*_*Tux 6 html jquery include cordova
我正在使用PhoneGap和jQuery Mobile创建一个原生的Android应用程序.
当我创建一个多页面时,我不会一直包含相同的导航栏.所以我试着加入一个(s)html.但它不起作用.这是我迄今为止尝试过的:
<!--#include file="navigation.inc.html" -->
<!--#include virtual="navigation.inc.html" -->
<!--#include file="navigation.inc.shtml" -->
<!--#include virtual="navigation.inc.shtml" -->
Run Code Online (Sandbox Code Playgroud)
此页面未放置在(Web)服务器上.如果navigation.inc.shtml不是服务器,是否可以使用html或javascript包含该文件?
我遇到了同样的问题.据我所知,Android忽略了服务器端包含.
load基于此answer,我一直在接近答案,但我采取了稍微不同的方法:
无论何时需要包含外部文件:
<div data-include="footer"></div>
Run Code Online (Sandbox Code Playgroud)
然后,在我的(多页)index.html结束时
$('div[data-include]').each(function() {
$(this).load( $(this).attr('data-include') + '.html').trigger('create');
});
Run Code Online (Sandbox Code Playgroud)
问题是它不适用于初始页面视图.任何后续页面看起来都很棒
| 归档时间: |
|
| 查看次数: |
7771 次 |
| 最近记录: |