Commit 2a44dba5 authored by Nigel McNie's avatar Nigel McNie
Browse files

Add a CSS file that is only hooked in if javascript is enabled.

We can use this to apply certain styles when javascript is around - most notably, to have stuff that is shown when javascript is off, but hidden by default when it is on.

There are two classes provided to help with this: js-hidden and nojs-hidden. They hide the element they're applied to when javascript is on or off respectively.
parent 41eefaea
/**
* Hooks in a stylesheet that is only loaded when javascript is enabled
*
* Copyright (C) 2009 Catalyst IT Ltd
* This file is licensed under the same terms as Mahara itself
*/
var styleNode = createDOM('link', {
'rel' : 'stylesheet',
'type': 'text/css',
'href': config['theme']['style/js.css']
});
appendChildNodes(getFirstElementByTagAndClassName('head'), styleNode);
......@@ -595,6 +595,7 @@ function themepaths() {
'images/success.gif',
'images/icon_problem.gif',
'images/icon_help.gif',
'style/js.css',
),
);
}
......
/**
* CSS rules to apply only when javascript is available
*
* Copyright (C) 2009 Catalyst IT
* This file is licensed under the same terms as Mahara itself
*/
.js-hidden {
position: absolute;
visibility: hidden;
top: 0;
}
.nojs-hidden-inline {
display: inline;
}
.nojs-hidden-block {
display: block;
}
......@@ -58,6 +58,9 @@ body {
.hidden {
display: none;
}
.nojs-hidden-inline, .nojs-hidden-block {
display: none;
}
/* Hides without browsers removing from the dom tree */
.safe-hidden {
position: absolute;
......
......@@ -28,6 +28,7 @@
<link rel="stylesheet" type="text/css" href="{$cssurl}">
{/foreach}
<link rel="stylesheet" type="text/css" href="{theme_path location='style/print.css'}" media="print">
<script type="text/javascript" src="{$WWWROOT}js/css.js"></script>
<link rel="shortcut icon" href="{$WWWROOT}favicon.ico" type="image/vnd.microsoft.icon">
</head>
<body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment