diff --git a/Readme.md b/Readme.md index 532b03a..db6ecbc 100755 --- a/Readme.md +++ b/Readme.md @@ -99,6 +99,9 @@ viewportUnitsBuggyfill.init({refreshDebounceWait: 250}); // viewportUnitsBuggyfill.init({hacks: window.viewportUnitsBuggyfillHacks}); +// append the patched stylesheet to body instead of head +viewportUnitsBuggyfill.init({appendToBody: true}); + // update internal declarations cache and recalculate pixel styles // this is handy when you add styles after .init() was run viewportUnitsBuggyfill.refresh(); diff --git a/index.html b/index.html index 42f618b..9343f6c 100755 --- a/index.html +++ b/index.html @@ -23,7 +23,7 @@ - +

Note: this script will only work with browsers that have buggy implementations of viewport units and will not polyfill viewport units in older browsers (e.g. IE <= 8)

@@ -33,7 +33,9 @@ // milliseconds to delay between updates of viewport-units // caused by orientationchange, pageshow, resize events refreshDebounceWait: 250, - hacks: window.viewportUnitsBuggyfillHacks + hacks: window.viewportUnitsBuggyfillHacks, + // append to body + appendToBody: true }); diff --git a/viewport-units-buggyfill.js b/viewport-units-buggyfill.js index f437c25..d2f98c6 100755 --- a/viewport-units-buggyfill.js +++ b/viewport-units-buggyfill.js @@ -161,7 +161,7 @@ initialized = true; styleNode = document.createElement('style'); styleNode.id = 'patched-viewport'; - document.head.appendChild(styleNode); + document[options.appendToBody ? 'body' : 'head'].appendChild(styleNode); // Issue #6: Cross Origin Stylesheets are not accessible through CSSOM, // therefore download and inject them as