All I'm trying to do is to call a function when a DIV
is scrolled.For simplicity sake Im not specifying anything else. Also I am only looking at DOM compliant browsers like Chrome, Safari (not IE).
MY problem is that the scroll handler never gets called. If I replace the scroll
to click
, it works when I click. Somehow the scroll is not working.
Please note: I cannot use jQuery :(
Here is my code:
HTML:
<div id="test">--long content--</div>
JS:
function myFunc() {
console.log('in myFunc');
}
var objTable = document.getElementById("test");
objTable.addEventListener("scroll", function () {
myFunc();
}, false);
FIDDLE: