Pause animation in docs if elem is out of viewport

> Proposed solution for #14409

Fairly simple fix to address possible memory leak caused by constant looping animation in documentation (progress bars).

When animated element is out of the viewport, it gains a `js-pause` CSS class that sets `animation-play-state` to `paused`.

Using a small scroll debouncer for performance considerations.

FYA @fat @cvrebert