bp_dtheme_remove_nojs_body_class()

Dynamically removes the no-js class from the <body> element.


Description Description

By default, the no-js class is added to the body (see bp_dtheme_add_no_js_body_class()). The JavaScript in this function is loaded into the element immediately after the tag (note that it’s hooked to bp_before_header), and uses JavaScript to switch the ‘no-js’ body class to ‘js’. If your theme has styles that should only apply for JavaScript-enabled users, apply them to body.js.

This technique is borrowed from WordPress, wp-admin/admin-header.php.

See also See also


Top ↑

Source Source

File: bp-themes/bp-default/functions.php

function bp_dtheme_remove_nojs_body_class() {
?><script type="text/javascript">//<![CDATA[
(function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})();
//]]></script>
<?php
}

Top ↑

Changelog Changelog

Changelog
Version Description
BuddyPress (1.5).1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.