I have some window.onscroll
event
$(window).scroll(function(e){
//My Stuff
});
but in my code I call animate scroll to som
$('#scroller').scroll(function(e) {
if (e.originalEvent) {
// scroll happen manual scroll
console.log('scroll happen manual scroll');
} else {
// scroll happen by call
console.log('scroll happen by call');
}
});
$('#scroller').scroll(); // just a initial call
When you scroll by call the e.originalEvent
will undefined
but when scroll manually it will give scroll
object.
DEMO
ive reasked this question and got 2 helpful answers.
i'll link the question here for others who'll find this thread.
Detect if a scroll event is triggered manually in jQuery