These warnings are "normal." Web browsing basically tells you that some events are related to a scroll event or even a touch event, which can slow down the application. Google docs recommend, for example, using intervals instead of performing calculations or functions directly on touchmove / drag events, which is not always possible with a web-based mobile app depending on what you're trying to do UX.
Also, if you use setInterval, you will have to use crazy aggressive timings such as 10 ms and your scroll / drag will look very bad. Just forget these warnings, they are very general and most likely recommendations, but most of the time cannot be avoided.
If you still want to avoid the warning, here is a jQuery example. The idea is to catch any values ββfrom the event, and then do the calculations in a separate thread.
var int, x, y; $('#mydiv').on('touchstart', function(event){ int = setInterval(work, 20); }); $('#mydiv').on('touchend', function(event){ clearInterval(int); }); $('#mydiv').on('touchmove', function(event){ x = event.touches[0].pageX; y = event.touches[0].pageY; }); function work(){
Eric
source share