X
xevi.matavacas
Hi friends,
I found a problem while "scrolling into view" and to overcome this I
made a function to simulate javascript's function. I would like to
share it and here it is:
function alternativeScrollIntoView(parentDiv,elementIntoDiv)
{
var principal =parentDiv;
principal.scrollTop = 0;
var rects = principal.getClientRects()[0];
var topFinal = rects.top;
var bottomFinal = rects.bottom;
var bottomActual = elementIntoDiv.getClientRects()[0].bottom;
if (bottomActual == 0)
{
return;
}
while(bottomActual>bottomFinal||bottomActual<topFinal)
{
var direction="down";
if(bottomActual<topFinal) direction="up";
principal.doScroll(direction);
bottomActual=elementIntoDiv.getClientRects()[0].bottom;
}
}
It worked in my enviroment, i hope it could be useful for you too.
Xevi.
PS: It was done for IE. I didn't test it in other enviroments.
I found a problem while "scrolling into view" and to overcome this I
made a function to simulate javascript's function. I would like to
share it and here it is:
function alternativeScrollIntoView(parentDiv,elementIntoDiv)
{
var principal =parentDiv;
principal.scrollTop = 0;
var rects = principal.getClientRects()[0];
var topFinal = rects.top;
var bottomFinal = rects.bottom;
var bottomActual = elementIntoDiv.getClientRects()[0].bottom;
if (bottomActual == 0)
{
return;
}
while(bottomActual>bottomFinal||bottomActual<topFinal)
{
var direction="down";
if(bottomActual<topFinal) direction="up";
principal.doScroll(direction);
bottomActual=elementIntoDiv.getClientRects()[0].bottom;
}
}
It worked in my enviroment, i hope it could be useful for you too.
Xevi.
PS: It was done for IE. I didn't test it in other enviroments.