I'm currently attempting to add a scroll animation to my section1 element, but for some reason, it's not working. This is puzzling to me because I've successfully implemented the same scroll code on another element without any issues. The only difference is that the other element is visible from the start, while section1 is initially off-screen.
Here's my code:
$(window).scroll(function(){
//section1
var scrollPos = $(window).scrollTop();
if( ( scrollPos > 150 ) && ( scrollState === 'top' ) ) {
$("#section1").animate({left: '60'}, 700);
scrollState = 'scrolled';
}
});
#section1 {
text-align: center;
margin-top: 3em;
margin-bottom: 3em;
font-size: 1em;
height: auto;
font-family: 'Open Sans', sans-serif;
position: relative;
left: -60em;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="section1" class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p>blablablablablablablabla </p>
</div>
</div>
</div>