答案 0 :(得分:0)
你可以在没有点击事件的情况下使用JQuery
$(document).scroll(function() {
var y = $(this).scrollTop();
if (y > 200 && y < 600) {
$('.magic').fadeIn();
} else {
$('.magic').fadeOut();
}
});
body {
height: 4000px;
}
.magic {
display: none;
position: fixed;
width: 100%;
height: 60px;
border-top: 1px solid #000;
background: blue;
z-index: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>this is a simple page keep scrolling... </p>
<div class="magic"></div>
<div class="otherdiv"></div>