www.webdeveloper.com
Results 1 to 5 of 5

Thread: Scroll object into view

  1. #1
    Join Date
    Jan 2004
    Posts
    198

    Scroll object into view

    Is there a way to scroll an object into view of the user's screen, or viewport, if it is not already? For example, if I perform some action and I have a reference to an object which currently is scrolled out of view, is there a way to scroll that object into view? Can this be done with just the object reference, or will its position need to be determined as well?

  2. #2
    Join Date
    Jan 2004
    Posts
    198
    I just found an IE-specific method named scrollIntoView(), which does exactly what I was asking for. Is there a similar method that Mozilla browsers use, or does someone know of a method that was written to simulate this effect?

  3. #3
    Join Date
    Jul 2003
    Location
    Boston Area, Massachusetts
    Posts
    3,489
    I actually believe Mozilla implements HTMLElement.scrollIntoView as well.

  4. #4
    Join Date
    Jan 2004
    Posts
    198
    Doesn't that figure.... I just tried it out and you are right, thank you. I must have a book that is out of date because it says that the scrollIntoView() method is for IE only.

    Thanks again.

  5. #5
    Join Date
    Jul 2003
    Location
    Boston Area, Massachusetts
    Posts
    3,489
    No problem. Your book is somewhat correct because I believe it actually started as an IE-only method and then Mozilla just eventually chose to implement it as well. Much like with other non-standard things such as innerHTML. Further, I believe you could emulate HTMLElement.scrollIntoView via fragment idendifiers, or via the method as described on this page.
    Last edited by fredmv; 04-27-2004 at 04:41 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles