This is a suggestion to NING. Could you give every page an individual unique class name in <body>? Then we can easily write CSS or Javascript for a special page.
For example <body class="auto-generated-class-name">
Actually we did this in Yahoo! Just for safe if someone need to change something later.
And kindly give every text box an individual unique class name or id. Thank you.
Permalink Reply by Antavius Flagg on June 21, 2011 at 12:38pm
Permalink Reply by Brian Kopper on January 15, 2012 at 2:46pm Hey Alex and Antavious,
I was craving this feature myself, so I figured out how to do it using javascript. This script will add the page url as the class(es) for any page on your site. If you are on the home page it will set the body class to "home". If you are on /profiles/members/ it will add the body class "profiles members", etc. Check it out. I hope it helps.
You'll need to paste this code in the "Custom Code" interface for your Ning network.
<!-- begin setBodyClass -->
<script type="text/javascript">
function setBodyClass() {
var url = new String(window.location.pathname);
dirs = url.split('/');
classes = '';
if (dirs) {
for (i = 0; i < dirs.length; i++) {
var dir = dirs[i].split('.'); // removes file extentions
if (dir[0]) {
classes += ' ';
classes += dir[0].toLowerCase();
}
}
}
if (classes == '') classes = 'home';
// check if body has an existing class
if (!document.body.className) {
document.body.className = classes;
} else {
var newClassName = document.body.className;
newClassName += classes;
document.body.className = newClassName;
}
}
setBodyClass();
</script>
<!-- end setBodyClass -->
Rosemary Burns joined Allison Leahy's group
Allison Leahy joined arqueologiadigital.com's group
Sylvia Hysen replied to Sylvia Hysen's discussion 'Great Slider- must see!'
Michelle Duchemin replied to Phil McCluskey's discussion 'Mini Release: CSS classes and bug fixes'© 2013 Created by Ning.
