0
我想用jQuery跟蹤滾動事件,它在頁面加載時起作用,但當我從其他頁面返回時,滾動事件沒有被解僱。如何使用jQuery Mobile跟蹤滾動事件,當我從頁面返回時
我正在製作和應用jQuery Mobile,我嘗試了沒有jQueryMobile庫,並完美地工作。
我每頁有一個html文件。
這是一個示例:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.js"></script>
</head>
<body style="height:200%;">
<div data-role="page" id="page">
<a href="http://google.com">link</a>
</div>
<script>
//$(document).on("pageinit", "#page", function(event) {
$(function(){
$(window).on('scroll', function(){
console.log('scroll');
});
});
</script>
</body>
</html>
當我滾動頁面的第一負載,它顯示在控制檯「滾動」,但是當我點擊了鏈接,我回來的頁面,當我滾動頁面沒有任何反應。