SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: ScrollBar Issue

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question ScrollBar Issue

    When Scroll Bar is scrolling, at that time how can we find using js what is the element at the topmost position in that window pane only.

    When the user scrolls down, the value of element at the time of that at topmost position

  2. #2
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to figure out which elements of a document are visible as
    the user scrolls the Firefox browser. I haven't written the code yet
    but I think I should be able to do it by keeping track of the current
    display using the following properties:
    window.content.scrollX, window.content.scrollY,
    window.content.innerWidth, window.content.innerHeight. -- with these 4
    I can determine which part of the document is visible.

    Then for each element I can figure out its display position using,
    offsetWidth, offsetHeight, offsetTop, offsetLeft. This would entail
    traversing the DOM and perculating the offset values down to all the
    children.

    While this would likely work, it seems inefficient. Do you know of any
    other ways to determine which elements are actually on the screen?


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
  •