bp_dtheme_remove_nojs_body_class

Dynamically removes the no-js class from the element.

Description

bp_dtheme_remove_nojs_body_class(); 

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.


Usage

  1. if ( !function_exists( 'bp_dtheme_remove_nojs_body_class' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_dtheme_remove_nojs_body_class(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-themes/bp-default/functions.php  
  1. function bp_dtheme_remove_nojs_body_class() { 
  2. ?><script type="text/javascript">//<![CDATA[ 
  3. (function() {var c=document.body.className;c=c.replace(/no-js/, 'js');document.body.className=c;})(); 
  4. //]]></script> 
  5. <?php