Fix requestAnimationFrame for browsers which have no native raf.

Browsers without native raf end up currently in endless loop.
I use  top instead of window, because there are bugs where animation frame is used inside of an iframe and this stops to work sometimes.