0
我建立了一个网站,使用stellar.js视差效果和niceScroll.js平滑滚动。 现在我不确定是什么导致了问题,但我不能水平或垂直滚动,对于垂直滚动,我明确指定“body”的height属性为500%,“html”将其设置为100%。 但显然我不能使用这个解决方法的宽度属性。 任何解决方案?网页不滚动
注意:如果我从我的js文件中删除了nicescroll的初始化,我无法向任何方向滚动,无论我设置了多少宽度和高度。
下面是HTML的基本结构:
<html>
<body>
<div class="main">
<div class="slide" data-slide="1" data-stellar-background-ratio="0.2">
<div id="slide-1">content</div>
</div>
<div class="slide" data-slide="1" data-stellar-background-ratio="0.2">
<div id="slide-2">content</div>
</div>
</div>
</body>
</html>
而CSS:
html{
font-family: 'Montserrat', sans-serif;
width:auto;
height:100%;
}
body{
font-family: 'Montserrat', sans-serif;
width:auto;
height:500%;
}
.slide{
background-attachment:fixed;
width:100%;
height:100vh;
position:relative;
}
.main{
height:100vh;
}
#slide1{
width:100%;
height:100%;
background: url(../imgs/bkg-home-1.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
而且JS:
$(document).ready(function() {
$("html").niceScroll(); // Initializing the nicescroll for the whole document
$('.main').stellar();
});
我该怎么办?它的这样一个正常的功能,我觉得这真的很烦人。