我正在使用jQuery Mobile,並且在用戶單擊家中的某個按鈕後,我想將瀏覽器重定向到另一個頁面。 要做到這一點,我寫道:更改頁面後不會觸發Pageshow
$.mobile.changePage("album-search-results.html",{
data:{area:searchArea, value:searchValue},
transition: "pop"
});
,它工作正常,它加載正確的頁面,它甚至把該URL正確的價值觀。不幸的是,頁面顯示事件沒有被觸發:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
</head>
<body>
<div data-role = "page" data-theme = "d" id = "SearchResults">
<div data-role = "header">
<h1>Aggregator</h1>
</div>
<div data-role = "content">
</div>
</div>
<script type="text/javascript">
$("#SearchResults").on("pageshow",function(event, ui){
console.log(ui.prevPage);
});
</script>
</body>
</html>
當我從前一頁加載該頁面時,控制檯始終爲空。哪裏不對? 感謝
我以爲pageshow僅是爲目標文檔的事件? https://developer.mozilla.org/en-US/docs/Web/Events/pageshow – NoBugs