I am making ajax call based on scroll event and getting some more data and displaying, that calls are working perfectly in all browsers except IE11, Safari, Ios and I found the reason why because by deafault "Smooth Scrolling" is enabled for IE11 but i don't know about "Safari", "Ios" browsers. SO the ajax calls are calling frequently, so how to disable that setting using javascript or jquery.
I don't know if I understand you correctly, but if your problem is that scroll event is triggered to often, you should probably use debounce function. Simple implementation looks like this:
var scrollTimeout;
function onScrollHandler () {
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(function () {
// your ajax call
}, 200);
}
or just use debounce function from some library like lodash.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.