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.
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.
Can you post the source HTML?
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.
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);
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I works, but without the 'true'.