Changeset 5218
- Timestamp:
- 10/07/2011 04:08:03 PM (13 years ago)
- Location:
- branches/1.5/bp-themes/bp-default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/bp-themes/bp-default/_inc/css/default.css
r5164 r5218 1090 1090 width: 98%; 1091 1091 } 1092 body.no-js form#whats-new-form textarea { 1093 height: 50px; 1094 } 1092 1095 form#whats-new-form #whats-new-options select { 1093 1096 max-width: 200px; … … 1101 1104 overflow: auto; 1102 1105 height: 0; 1106 } 1107 body.no-js #whats-new-options { 1108 height: auto; 1103 1109 } 1104 1110 #whats-new:focus { -
branches/1.5/bp-themes/bp-default/functions.php
r5170 r5218 732 732 } 733 733 endif; 734 735 /** 736 * Adds the no-js class to the body tag. 737 * 738 * This function ensures that the <body> element will have the 'no-js' class by default. If you're 739 * using JavaScript for some visual functionality in your theme, and you want to provide noscript 740 * support, apply those styles to body.no-js. 741 * 742 * The no-js class is removed by the JavaScript created in bp_dtheme_remove_nojs_body_class(). 743 * 744 * @package BuddyPress 745 * @since 1.5.1 746 * @see bp_dtheme_remove_nojs_body_class() 747 */ 748 function bp_dtheme_add_nojs_body_class( $classes ) { 749 $classes[] = 'no-js'; 750 return array_unique( $classes ); 751 } 752 add_filter( 'bp_get_the_body_class', 'bp_dtheme_add_nojs_body_class' ); 753 754 /** 755 * Dynamically removes the no-js class from the <body> element. 756 * 757 * By default, the no-js class is added to the body (see bp_dtheme_add_no_js_body_class()). The 758 * JavaScript in this function is loaded into the <body> element immediately after the <body> tag 759 * (note that it's hooked to bp_before_header), and uses JavaScript to switch the 'no-js' body class 760 * to 'js'. If your theme has styles that should only apply for JavaScript-enabled users, apply them 761 * to body.js. 762 * 763 * This technique is borrowed from WordPress, wp-admin/admin-header.php. 764 * 765 * @package BuddyPress 766 * @since 1.5.1 767 * @see bp_dtheme_add_nojs_body_class() 768 */ 769 function bp_dtheme_remove_nojs_body_class() { 770 ?><script type="text/javascript">//<![CDATA[ 771 (function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})(); 772 //]]></script> 773 <?php 774 } 775 add_action( 'bp_before_header', 'bp_dtheme_remove_nojs_body_class' ); 776 734 777 ?>
Note: See TracChangeset
for help on using the changeset viewer.