chr*_*ris 9 javascript jquery browser-history jquery-mobile pushstate
我试图找到一个解决方法来刷新嵌套列表与jquery Mobile 1.1版本,目前只剩下一个空白页面.
我知道一个现有的解决方案是启用pushState但是会将您发送回列表的根目录并在下一个嵌套列表视图中使用历史状态.
我在下面提出的解决方案并不漂亮,但适用于iOS和更新的Android.
$(document).bind("mobileinit", function(){
var urlEx = '#&ui-page=5-0'; //ending of nested list url
if (window.location.href.indexOf(urlEx) != -1){
history.replaceState("", "0", "index.php");
setTimeout("window.location.href='https://FULLURL#/FULLURL&ui-page=5-0'",100);
}
window.history.pushState("", "0", "index.php");
});
Run Code Online (Sandbox Code Playgroud)
我意识到每个浏览器都不支持pushState和replaceState,我可以尝试使用:
window.location.href = window.location.href.substring(0,window.location.href.indexOf('#'));
Run Code Online (Sandbox Code Playgroud)
相反,但它变得更加用户体验.
我希望有人可以更好地了解可以做得更好或者如何更好/更可靠地完成任务.
$("#<mySelector>").listview("refresh");
或者
$("#<mySelector>").refresh("listview");
除非我完全误解了你的问题,否则你应该能够使用上面的任何一行来刷新你要添加到的列表,其中<mySelector>任何与 JQuery 兼容的选择器将返回你的列表视图。
| 归档时间: |
|
| 查看次数: |
933 次 |
| 最近记录: |