```js
document.onscroll = function() 
{
  if (document.documentElement.scrollTop + window.innerHeight > document.documentElement.scrollHeight * 0.75) 
  {
    var height = document.documentElement.height;
    document.documentElement.height = height + 500;
    alert('75%');
  }
};
```

```css
html {
  height: 1000px;
}
```

I want this code to run every time the scrollbar reaches 75% of its height to add 500px then repeat the function when it reaches the 75% again.

The code works on my environment but if I scrolled fast I get multiple alerts and the 500px gets added more than once.

I tried the following:

```
document.documentElement.scrollTop + window.innerHeight == document.documentElement.scrollHeight * 0.75

```

but it never alerted.