Avoiding page width with superscrollorama

245 views Asked by At

I have setup a few elements with superscrollorama and at the one point when scrolling down one element comes in from the left and another comes from the right and they meet at the middle.

The problem is that before scrolling down the user can actually scroll the page way over to the right, to where the element is actually hiding.

Is there a way to prevent this from happening with superscrollorama?

The code I have for the HTML and Javascript is something like this...

<div class="row">
    <div class="col-md-6" id="fly-from-left">This content comes from the left</div>
    <div class="col-md-6" id="fly-from-right">This content comes from the right</div>
</div>

<script>
$(document).ready(function() {
    var sscr = $.superscrollorama();
    sscr.addTween('#fly-from-left', TweenMax.from($('#fly-from-left'), 0.5, { css:{right:'10000px'}, ease:Quad.easeInOut }), 0, -350);
    sscr.addTween('#fly-from-right', TweenMax.from($('#fly-from-right'), 0.5, { css:{left:'10000px' }, ease:Quad.easeInOut }), 0, -350);
});
</script>
1

There are 1 answers

0
luidgi27 On

Assuming you don't have nothing to scroll horizontally in your website, you can use:

body{
  overflow-x:hidden;
}