Created
April 20, 2012 05:30
-
-
Save coolicer/2426306 to your computer and use it in GitHub Desktop.
Javascript : compatPositionFixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fixed IE6 Position Fixed | |
(function(){ | |
if(/MSIE 6/i.test(navigation.userAgent)) { | |
function compatPositionFixed(node) { | |
var top = 150; | |
node.style.position = "absolute"; | |
node.style.top = top + document.documentElement.scrollTop + 'px'; | |
window.attachEvent('onscroll',function(){ | |
node.style.top = top + document.documentElement.scrollTop + 'px'; | |
}); | |
} | |
compatPositionFixed() //require obj id | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment