這是非常正常的,因爲沒有調用滾動事件。你的身體應該足夠高,以允許滾動事件。在你的代碼中,你還沒有內容。嘗試添加大型內容height
。
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
$(window).scroll(function() {
alert("Hi!");
});
});
</script>
</head>
<body>
<div>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br>Scroll now<br></div>
</body>
</html>
來源
2016-10-04 07:52:26
TSR