我正在尝试以编程方式更改页面。第一行代码正在运行,但我不需要它被延迟,所以我尝试了第二行,但它不起作用。我错过了什么?
工作(但我不想延迟):
setTimeout(function () {
$(':mobile-pagecontainer').pagecontainer('change', '#pageId', { changeHash: false });
}, 1000);
不工作:
$(':mobile-pagecontainer').pagecontainer('change', '#pageId', { changeHash: false });
我在文档的<head>
中调用它,嵌套在“web app tester”中:
<script type="text/javascript">
if (("standalone" in window.navigator) && !window.navigator.standalone){
//is standalone capable, but not in standalone mode
} else if (("standalone" in window.navigator) && window.navigator.standalone){
//is standalone capable, in standalone mode
} else {
//standalone mode not supported, ie. Desktop.
//doesnt work:
$(':mobile-pagecontainer').pagecontainer('change', '#pageId', { changeHash: false });
//does work, but I don't want the delay:
setTimeout(function () {
$(':mobile-pagecontainer').pagecontainer('change', '#pageId', { changeHash: false });
}, 1000);
}
</script>
答案 0 :(得分:0)
它的代码可行。请检查。
LinkedList<Item>