mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 06:42:35 +00:00
Fix flash when selecting another theme and reloading the page
This commit is contained in:
parent
195bfd2f7f
commit
54a56a6354
1 changed files with 14 additions and 7 deletions
|
@ -20,8 +20,22 @@
|
|||
|
||||
<!-- MathJax -->
|
||||
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
|
||||
<!-- Fetch JQuery from CDN but have a local fallback -->
|
||||
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script>
|
||||
if (typeof jQuery == 'undefined') {
|
||||
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme = localStorage.getItem('theme');
|
||||
if (theme == null) { theme = 'light'; }
|
||||
$('body').removeClass().addClass(theme);
|
||||
</script>
|
||||
|
||||
<div id="sidebar" class="sidebar">
|
||||
{{#toc}}{{/toc}}
|
||||
|
@ -76,13 +90,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
<!-- Fetch JQuery from CDN but have a local fallback -->
|
||||
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script>
|
||||
if (typeof jQuery == 'undefined') {
|
||||
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Local fallback for Font Awesome -->
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue