layout/menu: don't show uncollapsed loading menu

We have a no-JS-friendly CSS showing the menu uncollapsed unless JS
is fully loaded. Even if the page loads pretty fast this looks still
ugly in JS-enabled browsers.

This patch adds a JS-snippet removing the no-js class from the HTML
element before the rendering engine reaches the body. You'll see no
more flickering in your JS-enabled browser.

fixes #6307
This commit is contained in:
Thomas Gelf 2014-05-26 13:46:14 +00:00
parent ce220c5ea7
commit 7fb910bf21
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,12 @@ $isIframe = isset($_GET['_render']) && $_GET['_render'] === 'iframe';
<!-- TODO: viewport and scale settings make no sense for us, fix this -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="<?= $this->href($cssfile) ?>" media="screen" type="text/css" />
<script type="text/javascript">
(function() {
var html = document.getElementsByTagName('html')[0];
html.className = html.className.replace(/no-js/, 'js');
}());
</script>
<? if ($isIframe): ?>
<base target="_parent"/>
<? endif ?>