Skip to content

Commit

Permalink
Added a small Javascript snippet to the main.gsp layout that adds a '…
Browse files Browse the repository at this point in the history
…js' CSS class to the body element if Javascript is enabled.
  • Loading branch information
pledbrook committed Jan 12, 2011
1 parent f50553c commit a733199
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion grails.org/grails-app/views/layouts/main.gsp
Expand Up @@ -14,12 +14,25 @@
<r:use modules="master"/>
<r:resourceLink uri="/images/favicon.ico"/>
<r:layoutResources/>

<r:script>
function addJsClass() {
var classes = document.body.className.split(" ");
if (classes.length == 1 && classes[0] == "") {
classes = ["js"];
}
else {
classes.push("js");
}
document.body.className = classes.join(" ");
}
</r:script>

<%-- Page-specific CSS goes in here --%>
<g:pageProperty name="page.pageCss" />
<g:layoutHead />
</head>
<body>
<body onload="addJsClass();">

<div align="center">
<g:render template="/content/logos" />
Expand Down

0 comments on commit a733199

Please sign in to comment.