1
我在开始时创建了一个带有启动页面的网站,然后我想要在屏幕上方向上滑动,并在按下箭头时消失。我正试图在Jquery中使用动画。我已经创建了一个Fiddle供您检查代码。向上滑动整页
HTML
<div class='sc'>
<div class='welcome'>
<h1>Welcome to Brownsover Walkers</h1>
</div>
<div class='intro'>
<p>#1 dog walkers in the Brownsover area</p>
</div>
JS
var load = function(){
$('.welcome').hide().fadeIn(2000);
$('.intro').delay(1300).hide().fadeIn(2000);
$('.arrow').delay(3000).hide().fadeIn(2000);
}
var unveil = function(){
$('.arrow').click(function(){
$('.sc').animate({
bottom: '5000px'
}, 500);
});
}
$(document).ready(load,unveil);
CSS
html {
background: url(http://www.brwalkers.esy.es/images/bg3.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.sc{
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 100%;
background-color: #e3e3e3;
-webkit-box-shadow: 2px 6px 16px 1px rgba(0,0,0,0.61);
-moz-box-shadow: 2px 6px 16px 1px rgba(0,0,0,0.61);
box-shadow: 2px 6px 16px 1px rgba(0,0,0,0.61);
}
.sc h1{
position: absolute;
text-align: center;
font-size: 70px;
font-family: 'Source Sans Pro', sans-serif;
font-weight: 200;
top: 30%;
bottom: 0;
left: 0;
right: 0;
}
.sc p{
position: absolute;
text-align: center;
font-family: 'Source Sans Pro', sans-serif;
font-weight: 200;
font-size: 25px;
top: 45%;
bottom: 0;
left: 0;
right: 0;
}
.arrow{
position: relative;
}
#arrow1{
cursor: pointer;
position: absolute;
margin: auto;
margin-top: 45%;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
我已经试过这可惜事与愿违工作。我认为这一切都与整页div .sc无法移动,但我不知道如何做。 –
然后问题是让它向上滚动的代码。我让显示窗口非常小,并能够看到行为。如果您已经看到整个页面,因为它是一个简短的页面,滚动到顶部并不会真的做任何事情。您必须调整页面内容才能看到效果。 – camiblanch