--- title: VisualViewport.onscroll slug: Web/API/VisualViewport/onscroll translation_of: Web/API/VisualViewport/onscroll ---

{{APIRef("Visual Viewport")}}{{ SeeCompatTable() }}

The onscroll event handler of the {{domxref("VisualViewport")}} interface is called when a viewport is scrolled, i.e. when the scroll event is fired.

Syntax

VisualViewport.onscroll = function(e) { ... }

Examples

VisualViewport.onscroll = function(e) {
  ...
}

Specifications

Specification Status Comment
{{SpecName('Visual Viewport','#dom-visualviewport-onscroll','onscroll')}} {{Spec2('Visual Viewport')}} Initial definition.

Browser compatibility

{{Compat("api.VisualViewport.onscroll")}}