After being nagged by my Windows Automatic Updates for quite some time, I finally decided to give in and just install the IE7 update. I made a mistake by not backing up my IE6 files, or trying to find a method to have IE6 co-exist with IE7.
Anyway, I found that the document.body.scrollTop method to find out how much of the page has been scrolled down doesn’t work anymore. Now I have to use document.documentElement.scrollTop. And since the only difference of IE7 and IE6 is reflected inside a long string in the navigator.appVersion or navigator.appName objects, a little Regular Expression has to be built.
Here is the snip I ended up with, to cater both IE6 and IE7:
switch(navigator.appName) { case 'Microsoft Internet Explorer': var myregex = /MSIE 7\.0/i; var myArray = navigator.appVersion.match(myregex); if(myArray.length > 0) scrollY = document.documentElement.scrollTop; else scrollY = document.body.scrollTop; break; default: scrollY = window.pageYOffset; }
Anyone found a better solution?
Popularity: 3% [?]
Related Articles
Tags: Development

