0

I am building up a website, using stellar.js for parallax effects and niceScroll.js for smooth scrolling. Now I am not sure what is causing the problem, but I can't scroll horizontally or vertically, for vertically scrolling I explicitly specified the height property of "body" to 500% and for "html" its set to 100%. But obviously I can't use this workaround for the width property. Any solution?

Note: If I remove the nicescroll's initialization from my js file, I can't scroll in any direction, no matter how much I set width and height to.

here is the basic structure of the 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>

And the 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;    
}

And the js:

$(document).ready(function() {
$("html").niceScroll();  // Initializing the nicescroll for the whole document
$('.main').stellar();
});

What should I do? Its such a normal feature and I am finding this really annoying.

dw19
  • 73
  • 2
  • 11

1 Answers1

0

You can use .scrollIntoView() for this. It will bring a specific element into the viewport.

Example:

document.getElementById( 'bottom' ).scrollIntoView();`