Static News Archive



   (30-Jan-07 13:24)  Annoying auto scrolling to the top of the page
Its really annoying that when i click to expand a new item (and the page is filled using ajax), the page scrolls back to the top.

So, i will implement a page scroll position getter and setter that will save the scroll position before a link is clicked, and set it again after the link details have been loaded.


var scrollX, scrollY;
function SaveScrollPosition()
{

if (document.all)
{
if (!document.documentElement.scrollLeft)
scrollX = document.body.scrollLeft;
else
scrollX = document.documentElement.scrollLeft;

if (!document.documentElement.scrollTop)
scrollY = document.body.scrollTop;
else
scrollY = document.documentElement.scrollTop;
}
else
{
scrollX = window.pageXOffset;
scrollY = window.pageYOffset;
}
}

function LoadScrollPositiong()
{
window.scrollTo(scrollX, scrollY);
}
Post a comment     
(12-Apr-07 13:14)  Posted by Euan
Just thought id drop a coment in :)

<-  (14-Jan-07 23:23)  Switching to Ubuntu... (8-Jun-07 9:33)  Back to the blog...  ->













(sitemap)