Hey everyone.
I am fixing up my website and I am trying to save the scroll coordinates when the website loads at half way of the 1000px (example) web page. I would also like to know if I locked my scrollbar, would it lock it at that position??
What is the exact code that I use? The website file is test.html.
Thank you for any help!!
Here is what I am looking for (approximately): http://img239.imageshack.us/img239/6996/scollcz1.jpg
savescrollcoordinates help!!
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- Gente
- Forum Contributor
- Posts: 252
- Joined: Wed Jun 13, 2007 9:43 am
- Location: Ukraine, Kharkov
- Contact:
Code: Select all
function getScrollY() {
var scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' )
{
//FF compliant
scrOfY = window.pageYOffset;
}
else if( document.body && document.body.scrollTop)
{
//DOM compliant
scrOfY = document.body.scrollTop;
}
else if( document.documentElement && document.documentElement.scrollTop)
{
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
}
return scrOfY;
}
function yourFunction()
{
............
}
// Determination of scroll
window.onscroll = yourFunction