【发布时间】:2011-12-26 16:37:57
【问题描述】:
JQuery Mobile 今晚让我哭了。我正在尝试构建自定义控件,因此我不会在我的应用程序中重复某些元素,这让我很难过。具体来说,我在 HTML 文件中有以下内容:
<div id="custom-header" data-role="header" data-position="inline" data-theme="f">
<a href="index.html" data-icon="back" style="margin-top:5px" data-theme="b">Back</a>
<div style="text-align: center; padding-top: 5px; padding-bottom: 3px"><img src="../images/logo.png" ></div>
<a href="index.html" data-icon="home" style="margin-top:5px" data-theme="b">Home</a>
</div>
在我的主文件中,我实际上是在做:
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>
<div data-role="page" id="test-console" data-theme="m">
<div id="me-header"></div>
<script>
$.get('header.html', function (retData) {
$('me-header').html(retData).trigger('create');
});
</script>
</div>
所以问题来了 - 标题的呈现方式与我将 header.html 的内容直接粘贴到我的 JQM 页面时不同。几乎感觉 trigger('create') 什么也没做。
有什么想法吗?我已经烧了大约三个小时,像http://jquerymobiledictionary.pl/faq.html 这样的教程似乎没有应用..
【问题讨论】:
标签: jquery dynamic mobile triggers controls