scrollIntoView scroll the whole page

Hi,

I am trying to use the scrollIntoView function for a boxlist element.
The problem is that in the first time  its scrolls the whole page, and only after that it scrolls the list.
VapiSoftAsked:
Who is Participating?
 
VapiSoftConnect With a Mentor Author Commented:
I found out that the problem happens only when the parameter is true.
So, although it does not scroll to the object (exactly) , I now use false.
0
 
Justin MathewsCommented:
Can you post the source HTML?
0
 
VapiSoftAuthor Commented:
The HTML is huge so I cannot post it, but the code that does it is very simple.

The attached code is a function that checks that a list has more items that it can hold, and then it sets the overflow to 'auto' and scrolls the 'last_selected_object' into view.
function setScrollbarState(name,last_selected_object)
{
 var obj=document.getElementById(name);
 obj.style.overflowY='hidden';
 if ((obj.scrollHeight-obj.offsetHeight) > 6) 
 {
  obj.style.overflowY='auto';
  if (last_selected_object)
  {
   var obj=document.getElementById(last_selected_object);
   if (obj) obj.scrollIntoView(true);
  }
 }
}

Open in new window

0
 
VapiSoftAuthor Commented:
I works, but without the 'true'.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.