How do i track the scroll events in JS. Is there any standard way to do it ?
Please help me ... ;)
Please help me ... ;)
<script type="text/javascript">
var golbal_var = 0;
function test(){
alert('');
document.getElementById('text_id').value = ++golbal_var;
}
</script>
</head>
<body onScroll=test()>
<input type='text' id='text_id'/>
<div style='width:2000px;height:2000px'/>
alert(document.body.scrollLeft+'\t'+document.body.scrollTop);
<body onLoad = _test()> <input type='text' id='text_id'/> <div style='width:2000px;height:2000px' id='div_id'> </div> </body>
function test(){
alert(document.body.scrollLeft+'\t'+document.body.scrollTop);
}
function _test(){
window.onscroll = test;
}
<html>
<head>
<style type="text/css">
#text_id {
position:fixed;
top:0px;
right:0px;
}
</style>
</head>
<body>
<input type='text' id='text_id'/>
<div style='width:2000px;height:2000px' id='div_id'>
</div>
</body>
</html>
Comment