I want to disable scroll-bar dragging while keeping all other means of capturing scroll events enabled.
A means of capturing a mousedown event on the scrollbar would also suffice (most text on that topic points to not possible). I do not want to use any external libraries to solve the issue. Any other means of coming to a solution to the problem described below are welcome.
The solution only has to work in current versions of Google Chrome.
document.getElementById('mainTable').parentNode.addEventListener("scroll",function(e){
...
//Other code logic and syntax omitted
...
//Logic for deriving if scrolling up or down is accomplished by comparing
//the previously recorded .scrollTop value to the current value of the div
//containing the table 'mainTable' of datapoints
if(scrollDownEvent){
document.getElementById("mainTable").parentNode.scrollTo(0,.75*totHeight);
}else if(scrollUpEvent){
document.getElementById("mainTable").parentNode.scrollTo(0,.25*totHeight);
}else{
}
}
Background Some really quick background information. I have several million data points with a large set of data for each point.
I load 200 data points into the html, into a table/tr/td set-up. I cache 400 data points into a javascript array of objects (roughly 100 above and below at any given point in time).
When the user scrolls down, if the edge of the datapoints being displayed comes near the edge of the cached data points, more points are loaded into the cache from the harddrive (via html5 file-system api). Depending on how far down the scroll event attributes state were scrolled defines how many data points are removed from the opposing end of the table and new data points are loaded into the target edge of the table. after handling the scroll event I then scroll to either 25% of the height of the table or 75% of the table.
The Problem I am running into is the scroll event appears to be fired differently with scrollbar drags than with other means of scroll events. I am capturing a scroll-bar drag event as a scroll event, but if I drag the scrollbar all the way to the bottom (my code works if I do not drag it all the way down), it'll sometimes appear to somehow overwrite my javascript code to scroll back up - thus resulting in an inability to scroll down farther and fire off anymore scroll events.
I have no issues with scroll events captured from:
- mouse wheel move
- mouse clicks on the up/down arrows
- mouse clicks on the upper/lower region relative to the scrollbar
- mouse downs on the upper/lower regions relative to the scrollbar.
- mouse downs on the up/down arrow buttons
- key down on keyboard up/down arrows