Onze vrijwilligers hebben dit artikel nog niet naar het Nederlands vertaald. Doe mee en help de klus te klaren!
U kunt het artikel ook in het English (US) lezen.

An event handler for scroll events on element.


element.onscroll = functionReference


functionReference is a reference to a function to be executed when element is scrolled.


<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8" />
  #container {
    position: absolute;
    height: auto;
    top: 0;
    bottom: 0;
    width: auto;
    left: 0;
    right: 0;
    overflow: auto;

  #foo {
    background-color: #777;
    display: block;

    <div id="container">
      <div id="foo"></div>

    <script type="text/javascript">
      document.getElementById('container').onscroll = function() {


The scroll event is raised when the user scrolls the contents of an element. Element.onscroll is equivalent to element.addEventListener("scroll" ... ).


Specification Status Comment
HTML Living Standard
The definition of 'onscroll' in that specification.
Living Standard  
Document Object Model (DOM) Level 3 Events Specification
The definition of 'onscroll' in that specification.
Obsolete Initial definition

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
Compatibility unknown  
Compatibility unknown

Documentlabels en -medewerkers

Laatst bijgewerkt door: SaschaNaz,