Skip to content
Browse files

Added a small Javascript snippet to the main.gsp layout that adds a '…

…js' CSS class to the body element if Javascript is enabled.
  • Loading branch information...
1 parent f50553c commit a733199696c3b819df676968727e2a0172914bf4 @pledbrook pledbrook committed Jan 12, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 grails.org/grails-app/views/layouts/main.gsp
View
15 grails.org/grails-app/views/layouts/main.gsp
@@ -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" />

0 comments on commit a733199

Please sign in to comment.
Something went wrong with that request. Please try again.