How To Disable Smooth Scrolling In Ie 11 Programatically
I am making ajax call based on scroll event that calls are working perfectly in all browsers except IE11 and I found the reason why because by deafault 'Smooth Scrolling' is enable
Solution 1:
All browsers on OS X, iOS Safari 8+, and a lot more have the same behavior. You can't and definitely shouldn't change it.
What you can do is limit the rate at which your function is called. Throttle it.
Open the your browser's console and look at this example. You'll see that the "scroll" is called often but the "throttled scroll" only once every 200ms at most.
var handler = function () {
console.log('scroll');
};
var throttledHandler = throttle(function () {
console.log('throttled scroll');
}, 200);
window.addEventListener('scroll', handler);
window.addEventListener('scroll', throttledHandler);
functionthrottle (callback, limit) {
// source: http://sampsonblog.com/749/simple-throttle-functionvar wait = false; // Initially, we're not waitingreturnfunction () { // We return a throttled functionif (!wait) { // If we're not waiting
callback.call(); // Execute users function
wait = true; // Prevent future invocationssetTimeout(function () { // After a period of time
wait = false; // And allow future invocations
}, limit);
}
}
}
<p>scroll me</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>---</p>
Post a Comment for "How To Disable Smooth Scrolling In Ie 11 Programatically"