I am using the following jQuery in my header.php file, which is remotely included in every page of my site:
function detectScrollbar()
{
if (navigator.appName == "Microsoft Internet Explorer")
{
window.name=document.body.scrollTop;
}
else
{
window.name=window.pageYOffset;
}
}
function doScroll()
{
if (window.name) window.scrollTo(0, window.name);
}
This code maintains the scroll position on page refresh. I would like to know how to turn it off on particular pages. If anyone can shed some light on this I would be very grateful. Many thanks in advance.
This may work.
Create something with a unique id that you don’t plan on using elsewhere on your site, so maybe the page name.
Then add the following to your jquery