dmpost dmpost - 1 year ago 124
Javascript Question

How CSS can disable window.onscroll?

The problem: Simple function doesn't called

window.onscroll = function() {

It will work if I remove the CSS link from the page

<link rel="stylesheet" href="/blog/css/style.css" type="text/css">

The question:
How CSS code can disable Javascript function window.onscroll ?

The page:

The CSS :

Answer Source

You are actually scrolling your container div. If you do this the events fire:

document.getElementById("container").onscroll = function() { 
    console.log("scroll container"); 

edit: looks like something changed on the page. If you use this on the above page it works correctly:

jQuery("body").on("scroll", function() {