In Javascript, I want to detect whether the user move the scroll bar or the scroll bar moved by script. I have write the code to move the div scrollbar using javascript. Here i want to differentiate the scroll position whether the user manually moved or it moved by script. I have used below code. But it detects all.
$("#log").scroll(function(e) {
console.log("scrolling");
});
var logDiv = document.getElementById('log');
logDiv.addEventListener('DOMMouseScroll', function() {
console.log("mouseEvent");
userManualScroll = true;
});
Pls help me.