Created
March 29, 2011 16:21
-
-
Save mattfarina/892665 to your computer and use it in GitHub Desktop.
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
$.support.positionFixed = (function () { | |
var el, support, | |
body = document.body || document.getElementsByTagName("body")[0] || document.documentElement; | |
// Boolean indicating whether or not "position: fixed" is supported. | |
// Using the DOM to create an element is much faster than using jQuery. | |
el = document.createElement("div"); | |
el.style.position = "fixed"; | |
el.style.top = "10px"; | |
el.style.visibility = "hidden"; | |
// Use insertBefore instead of appendChild to circumvent an IE6 bug. | |
// This arises when a base node is used. | |
body.insertBefore(el, body.firstChild); | |
support = parseInt(el.offsetTop, 10) - (body.scrollTop ? body.scrollTop : 0) === 10; | |
body.removeChild(el); | |
return support; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment