revised prevent animation loop on mobile device