Link to home
Start Free TrialLog in
Avatar of VapiSoft
VapiSoft

asked on

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.
Avatar of Justin Mathews
Justin Mathews

Can you post the source HTML?
Avatar of VapiSoft

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of VapiSoft
VapiSoft

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I works, but without the 'true'.