use raf it works on older browsers