我在jquery上做了一個快速模式,這樣當我滾動到頁面底部時,我會在底部角落獲得一個彈出窗口。基本上我需要使它只在滾動到頁面的那一部分時出現,並且您可以選擇關閉它。我如何去添加一個關閉功能?當滾動到頁面的那一部分時,也可以在顯示之前幾秒鐘延遲彈出。添加jquery模式關閉按鈕
謝謝!
<!DOCTYPE html>
<html>
<head>
<title>Peekaboo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<style>
html, body {
margin: 0;
padding: 0;
}
.content {
display: block;
min-height: 3000px;
}
.peekaboo {
position: fixed;
right: 0;
bottom: 0;
display: block;
width: 200px;
height: 150px;
background-color: red;
-webkit-transition: all 0.6s ease;
-o-transition: all 0.6s ease;
-ms-transition: all 0.6s ease;
transition: all 0.6s ease;
bottom: -150px;
}
.peekaboo.open {
bottom: 0;
}
</style>
<script>
$(function() {
$(window).scroll(function() {
// calculate the percentage the user has scrolled down the page
var scrollPercent = ($(window).scrollTop()/$(document).height()) * 100;
if (scrollPercent > 70) {
$(".peekaboo").addClass('open');
}
});
});
</script>
</head>
<body>
<div class="content">
</div>
<div class="peekaboo">
Peekaboo!
</div>
</body>
</html>
,一旦你關閉它,然後再滾動,它不應該顯示彈出是不是 – 2014-09-26 02:58:03