Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get scrollbar events

 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a table that can be set the viewable size so that if visible size is larger than the table size, scroll bar will automatically appear. Someone helped me by using this:

<DIV STYLE="width:416px;height:200px;overflow-y:auto;">
<TABLE STYLE="width:400px;" BORDER="1"> .....

Now I want to get scrollbar events from this automatically generated scrollbar, which doesn't have an id. How can I get events from it?

Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean onscroll?

Eric
 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure. I want to do something based on where the scroll position button is, then do the corresonding thing. Say, data to be displayed is divided into 3 parts. Initially the 1st part is loaded. If the scroll position button is being moved to the middle of the bar, or passed a certain length, then load the 2nd part of the data, if scroll position button is being moved down to the bottom, then the last part is loaded.

How could I do this?
Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the thing is if this data is not loaded, how would the scrollbar know how far it is need to scroll?

Eric
 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would think, if the user scroll it down and pass the half of bar length, then, I load the next part of the data. I hope this scenario would work.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem is this if you do not have that data on the page, then the scrollbar will not be that long for the person to scroll half way.

If this data in a table and you know how many rows, then you would be able to create a blank table with X number of rows and fill it in with Ajax. This has been done before, do not remember the link where it is at.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic