dixonandmoe / rellax

Lightweight, vanilla javascript parallax library
https://dixonandmoe.com/rellax/
MIT License
7.06k stars 878 forks source link

Defer update loop if no position is updated #164

Closed tditlu closed 5 years ago

tditlu commented 5 years ago

Browsers will nag you that the "page is running slow", because of the requestAnimationFrame running all the time. This pull request will defer the update if no position is changed, and add the loop again if a resize, scroll, orientationchange or touchmove event is triggered. It will also add scroll and touchmove events as passive.