?
Solved

scrollIntoView doing div ok but then also page

Posted on 2007-07-27
5
Medium Priority
?
1,587 Views
Last Modified: 2008-08-04
I've used scrollIntoView before, and now don't understand why this is behaving the way it is.

I do a scrollIntoView for a row in a table in a div.  The div has style overflow:auto.   When I do the scrollIntoView it scrolls the row up to the top of the div....but then it also scrolls the div up to the top of the browser page display (IE7).  

I've got other scrollIntoView in the same app that don't scroll the div to the top of the page, and I can't see any particular differences in the code and html.

I'm wondering if this is a problem that anyone might be familiar with...any help with it would be appreciated.

Thanks!
0
Comment
Question by:codequest
  • 3
5 Comments
 
LVL 3

Accepted Solution

by:
pee_cee earned 1500 total points
ID: 19626471
Just so you know, i'm having the same problem, you're not just going insane.
0
 
LVL 2

Author Comment

by:codequest
ID: 19639063
Thanks for the note, always good to know!
0
 
LVL 2

Author Comment

by:codequest
ID: 19639588
Thanks for the note, always good to know!
0
 
LVL 2

Author Comment

by:codequest
ID: 19639656
Perhaps we should try to recreate it using a very simple test case.  FYI, this is no longer an 'A' priority with me, but it's annoying and I would like to get it to work.  I use Gridviews in ASP.NET within scrollable <div's>, and there is no "built in" mechanism to get the selected gridview line to "scrollintoview".  So I have to write a mechanism like this:

> In server code, put the ID of the selected line in a hidden field
> (Can also set a hidden field value for "Do_ScrollIntoView = 'True'"
> In JS for the page, when the page opens, read the value from the hidden field
> Locate the Gridview table in the DOM
> Loop through the rows in the table
> Look in the appropriate cell in each row for the ID value (from the hidden field)
> When found, save the row
> Scroll the row into view

I've got it working in one critical case.  In another case I apparently didn't implement it very well.   And in the case described in this thread, I get the odd result reported above.

So, again, maybe we should try to reproduce it in a very simple case;  I'll repost if I get any results in that area.  Again though, just a heads up, it's not near the top of current "gotta get done" list.

Good luck!
0
 

Expert Comment

by:Shouha85
ID: 22151497
i have the same problem , and i need a solution for it before i get insane.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question