7 mobile jquery dynamic footer navbar
我想创建一个可以由我的jQuery Mobile应用程序中的所有页面使用的共享页脚(例如footer.html).但是,在从外部文件加载html后,我找不到让jQuery刷新页脚导航栏中样式的方法.在思考之后会非常感激.
Footer.html:
<div data-role="navbar" class="CSS" data-grid="d" id="footerNav">
<ul >
<li ><a href="#" id="a" data-icon="custom"><div>a</div></a></li>
<li ><a href="#" id="b" data-icon="custom"><div>b</div></a></li>
<li ><a href="#" id="c" data-icon="custom"><div>c</div></a></li>
<li ><a href="#" id="d" data-icon="custom"><div>d</div></a></li>
<li ><a href="#" id="e" data-icon="custom"><div>e</div></a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
index.html的:
<div data-role="page" style="position: relative" data-theme="a" id="index">
<div data-role="header">
<div class="homebutton" onclick="location.href='default.html'">
</div>
<h1>
EVENT CALENDAR</h1>
</div>
<div data-role="content">
<p>
This is a single page boilerplate template that you can copy to build you first
jQuery Mobile page. Each link or form from here will pull a new page in via Ajax
to support the animated page transitions.</p>
</div>
<div data-role="footer" class="CSO" data-position="fixed" id="footerDiv">
</div>
<script>
$('#index').live('pageinit', function (event, ui) {
$('#footerDiv').load('Shared/Footer.html');
[Some code to refresh the footer so it gets redrawn by Jquery Mobile]
});
</script>
Run Code Online (Sandbox Code Playgroud)
小智 8
假设其余代码有效:
$('#footerDiv').load('Shared/Footer.html').trigger("create");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11367 次 |
| 最近记录: |