103
rated 0 times
[
106]
[
3]
/ answers: 1 / hits: 90627
/ 11 Years ago, thu, march 7, 2013, 12:00:00
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:
More From » event-handling