Reputation: 6962
I know this question is pretty simple and I have used .scroll plenty of im times and it has worked so I have no idea what I could be wrong.
The following code works fine.
$(window).click(function(){
$(document).find('#center').css('display','none');
$(document).find('#up').css('display','inline');
});
But when I change it to the following nothing happens
$(window).scroll(function(){
$(document).find('#center').css('display','none');
$(document).find('#up').css('display','inline');
});
Upvotes: 1
Views: 104
Reputation: 70
You have an issue with your code - http://codepen.io/anon/pen/xZbLem for working answer
// JS
$(document).scroll(function(){
$('#center').css('display','none');
$('#up').css('display','inline');
alert('Scroll is working!');
});
// html
<div class="container">
<div id="center">center</div>
<div id="up">up</div>
</div>
Upvotes: 2