SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Determine Scrollbar Position

    I am trying to determine (in javascript) the distance that the scrollbar has moved. I have not been able to find any way of doing this. All of my searching has turned up nothing useful. The reason for this is I have a <div> with a <ul>. It is positioned absolute and frozen so when the user scrolls the page they can still see this <div>. The problem is when the user scrolls and then clicks on one of the <ul> items to drag it does not appear where the mouse was clicked. Does anybody know of a way to determine this?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Easiest way to figure out how to do something complex with JavaScript, if it's been done before, is to find someone else who's done it and look at how

    RobotReplay is a service that records users interacting with webpages. They capture mouse movements, clicks, scrolling, form interaction and more.

    A quick look at just the JavaScript files included on their homepage shows a potentially useful function called "robotRecorder.prototype.getScroll" that returns horizontal and vertical scroll values... just a hint

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the hint Dan.

    In which file did you come across the getScroll function? I could not find one.

    Looking at other examples the problem I'm having is that in IE the scrollTop variable is always 0, it doesn't seem to change even when I scroll.

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm not doing the dirty work for you, it's in one of the JavaScript files at the top of the page's source... one that doesn't sound like library functions but stuff they would've written themselves...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •