This works better if the body onload event handler is not used. Onload
only kicks in after the page is loaded so the first time each picture
is viewed the window will tend to jump down from the top.
Using window.onfocus in the head script instead works perfectly for me
in IE6, IE7 and Firefox. Safari and Opera don't work so a
window.onload event is still needed and they still jump the first
time. This is what I'm using now The php script stays the same as
above):
<code>
<script type="text/javascript">
<!--
var flag = 0;
function scrollWindow() {
if (flag == 0){
/* opac(); opacity function must be listed first if used */
window.scrollTo(0,<YS>);
flag = 1;
}
}
window.onfocus = scrollWindow;
window.onload = scrollWindow;
//-->
</script>
</code>
I put this in an external file
<code>
function setCookie(){
var scroll=typeof window.pageYOffset != 'undefined' ?
window.pageYOffset : document.documentElement.scrollTop;
document.cookie='yscroll' + "=" + scroll;
}
window.onscroll=setCookie;
function delete_cookie ( cookie_name )
{
var cookie_date = new Date ( ); /* current date & time */
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" +
cookie_date.toGMTString();
}
</code>
and in the navigation links container/s I use this :
onclick="delete_cookie ( 'yscroll' );"
I've also been paranoid and have been preloading all the thumbnails if
the cookie doesn't exist