I am looking to create an event that triggers whenever the user scrolls up or down within a hidden div called a 'scroller'. Here is the setup:
CSS
#scroller {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 50px;
}
#scroller div {
position: absolute;
top: 0px;
left: 0px;
height: 50000px;
width: 100%;
}
span {
position: absolute;
top: 20px;
left: 100px;
}
HTML
<div id="scroller"><div></div></div>
<span></span>
Javascript
var timeout;
$("#scroller").scroll(function ()
{
clearTimeout(timeout);
$('span').text('scrolling');
timeout = setTimeout(function ()
{
$('span').text('');
}, 1000);
});
When the user scrolls inside the above div, the word "scrolling" should be displayed on the screen. You can test it out with this fiddle : http://jsfiddle.net/f1hxndt4/4/
There are two issues with the current setup :
- The scrolling within the 'scroller' needs to be continuous in both directions (up and down) - Currently restricted to 50000px scroll.
- The "scroller" must be invisible. Currently, the scrollbars are visible.
Any helpful suggestions would be highly appreciated, thank you!