dmpost
dmpost

Reputation: 96

How CSS can disable window.onscroll?

The problem: Simple function doesn't called

window.onscroll = function() { 
    console.log("scroll");
}

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: http://swimbi.com/blog/

The CSS : http://swimbi.com/blog/css/style.css

Upvotes: 0

Views: 535

Answers (1)

Dick van den Brink
Dick van den Brink

Reputation: 14519

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() { 
    console.log(this) 
})

Upvotes: 4

Related Questions