Last active
August 29, 2015 14:00
-
-
Save johanneslumpe/11139066 to your computer and use it in GitHub Desktop.
Fullsize background videos in webkit browsers gist 6
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
// quick and dirty check for webkit, which has a bug that it does not compute the | |
// proper scrollTop, when overflowX is set on the body. We can use this to decide | |
// when we have to disable fixed-attachment backgrounds, because they lead to a rendering | |
// issue in webkit. This test is just a naive implementation and probably could be improved | |
// but works fine for now. | |
var overflowScrollTopBuggy = function overflowScrollTopBuggy () { | |
if (testFixedBackgrounds.buggy) { | |
return testFixedBackgrounds.buggy; | |
} | |
var body = document.querySelector('body'); | |
var s = document.createElement('style'); | |
s.innerHTML = 'html,body {overflow-x: hidden;}'; | |
body.appendChild(s); | |
body.scrollTop = 1; | |
overflowScrollTopBuggy.buggy = (body.scrollTop === 0); | |
body.scrollTop = 0; | |
body.removeChild(s); | |
return overflowScrollTopBuggy.buggy; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment