Skip to content

Instantly share code, notes, and snippets.

@resting
Forked from siromega/gist:1348779
Created August 7, 2017 03:46
Show Gist options
  • Save resting/46f402acb13344478b653c8722a8be33 to your computer and use it in GitHub Desktop.
Save resting/46f402acb13344478b653c8722a8be33 to your computer and use it in GitHub Desktop.
Fixing FOUC with jQueryMobile
<!DOCTYPE html>
<html class="no-js">
<head>
<!-- stuff -->
<!-- FOUC fix -->
<style type="text/css">
.no-js {display: none;}
</style>
</head>
<body>
<!-- all my html -->
<!-- load all my javascripts down here -->
<script src="../jsc/jquery-1.6.1.js?v=1"></script>
<script src="js/jquery.mobile-1.0rc2.js?v=1"></script>
<script src="js/jquery-ui-1.8.13.autocomplete.min.js"></script>
<script src="../jsc/json2.js"></script>
<script src="js/app.js?v=1"></script>
<script src="../jsc/jquery.microtemplate.js"></script>
<script>
// borrowed from Mr. Paul Irish http://paulirish.com/2009/avoiding-the-fouc-v3/ (thanks!)
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)
</script>
<script type="text/javascript" >
$(document).ready(function() {
loadeddocument();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment