【发布时间】:2013-01-29 07:34:40
【问题描述】:
我正在使用 jQueryMobile 开发一个 PhoneGap 应用程序。我的问题是listview 没有在相册页面上正确显示,而是在主页上。我对两者都使用相同的data-theme。
问题:为什么第二页的listview显示不正确(背景、字体、图标)?
研究:
- jQueryMobile documentation on thumbnail listviews (what I'm trying to accomplish)
- jQueryMobile documentation on
listviewapi - Google searched and found a tutorial on how to do this (no change)
专辑页面代码
<div data-role="page" id="albums" data-url="albums" data-theme="a">
<div data-role="header">
<a href="#home" data-role="button" data-corners="true" data-shadow="true">Back</a>
<h1>Albums</h1>
<button id="albums-refresh">Refresh</button>
</div>
<div data-role="content">
<ul id="albums-content" data-role="listview" data-inset="true"></ul>
</div>
</div>
动态填充listview的jQuery函数
Load: function () {
$("#albums-content").empty();
$.ajax({type: "GET", url: "https://itunes.apple.com/lookup?id=356541460&entity=album", data: {get_param: "results"}, dataType: "json", success: function (data) {$.each(data, function (index, element) {$.each(this, function (index, element) {if (element.wrapperType === "collection") {$("#albums-content").append("<li><a id='a-" + index + "' href='#album-details'><img src='" + element.artworkUrl100 + "' />" + element.collectionName + "</a>"); $("#a-" + index).bind('click', function (index) {Albums.AlbumID = index; }); }}); }); }});
}
PhoneGap 调试:
专辑页面 请注意,紫色背景和橙色文本不存在,但您可以在第二张专辑下方看到listview 阴影的微弱暗示。
【问题讨论】:
标签: jquery listview cordova jquery-mobile