append()listview Javascript后丢失JQuery Mobile CSS样式
Lost of JQuery Mobile CSS Style after append() listview Javascript
我知道以前有人问过这个问题,但我已经尝试了所有能找到的解决方案,但都无济于事。
我的jqm样式没有初始化,很像这个家伙的问题:JQuery-mobile->append()是否删除CSS?我尝试过.trick("create")和listview("fresh")方法,甚至两者的组合。
翡翠:
#category(data-role='page')
a(href='#automobile', data-transition='slide', onclick="return loadItemsBrief('automobile');")
| Automobile
... //code reduced here
#automobile(data-role='page')
div(data-role='content')
div#refresh(data-role='fieldcontain')
ul#autoList(data-role='listview', data-divider-theme='b', data-inset='true')
Javascript(separate.js)
function loadItemsBrief(cat){
$.getJSON(''+cat, function (json) {
$.each(json.items,function(i,data) {
$('#autoList').append('<li data-theme="c"><a href="" data-transition="slide" class="touchableButton"><div style="display: inline-block"><img style="width: 100px; height: 125px" src=""'+data.fileUrls[0]+'></div><div style="display: inline-block"><h3>Title: '+data.name+'</h3><h3>Price: '+data.minBid+'</h3><h3>Condition: '+data.condition+'</h3></div></a></li>'); //tried .trigger('create') here
});
$('#autoList').listview('refresh'); //also tried placing .listview('refresh') in inner most layer
});
}
firebug给我的错误是:
TypeError: $(...).listview is not a function
$("#autoList").listview("refresh");
我们将非常感谢您的帮助,谢谢!
显然,在尝试了所有可能的解决方案后,我尝试将JQuery版本更改为1.8.3,并将JQM版本保留为1.3.1。现在所有列表视图都正常刷新。
相关文章:
- 无法从jquery Mobile导航栏重定向到另一个页面
- jquery mobile上多个页面上的一个表单
- window.location使用jquery mobile实现chrome跳转
- 防止jQuery Mobile中的ajax缓存
- 如何在JQUERY Mobile上放置谷歌地图
- JQuery Mobile Javascript复杂方程式
- jQuery Mobile Undefined不是一个函数
- jQuery mobile not going through ID
- 如何使用javascript或jquery mobile从url读取和显示XML文件
- jQuery Mobile Collapse上的AJAX请求
- 应用程序在呈现Jquery Mobile之前显示无样式的Html
- 如何在jQuery Mobile 1.4 Datepicker中创建事件
- UIWebview赢得't通过基本身份验证加载动态加载的资源(通过jQuery mobile)
- jQuery Mobile到其他页面的锚链接不起作用
- 如何在jQuery Mobile中设置100%宽度的输入类型日期
- JQuery Mobile破坏了我的布局:如何禁用自动打字
- 防止用户在jQuery Mobile中ajax加载页面时单击其他位置
- 根据手机上是否存在文件,在jQuery mobile中动态填充列表视图
- Image Sprites和jQuery Mobile Ajax导航的问题
- jQuery Mobile:如何在$.Mobile.changePage之前运行回调函数