Use the following script to detect scroll up and scroll down events
<script type="text/javascript">
$(document).ready(function(){
var LastScroll=0;
// I am using div element's scroll here.
$("div").scroll(function(){
if(LastScroll<$("div").scrollTop())
{
//scroll down event
}
else
{
//scroll up event
}
LastScroll=$("div").scrollTop();
});
})
</script>
<script type="text/javascript">
$(document).ready(function(){
var LastScroll=0;
// I am using div element's scroll here.
$("div").scroll(function(){
if(LastScroll<$("div").scrollTop())
{
//scroll down event
}
else
{
//scroll up event
}
LastScroll=$("div").scrollTop();
});
})
</script>
Comments
Post a Comment