简体   繁体   English

如何从richfaces组件中删除css类?

[英]How can I remove the css classes from a richfaces component?

I'm using a rich:simpleTogglePanel and it puts these 3 css classes on the divs: 我正在使用rich:simpleTogglePanel ,它将这3个css类放在div上:

rich-stglpanel
rich-stglpanel-header
rich-stglpnl-marker
rich-stglpanel-body

Is there any way that I can remove those classes? 有什么办法可以删除这些课程吗?

Every Richfaces component comes with a set of CSS classes. 每个Richfaces组件都带有一组CSS类。 These CSS classes are used to customize the aspect of your toggle panel (or any other RF component). 这些CSS类用于自定义切换面板(或任何其他RF组件)的方面。 The four CSS classes, as explained in the component guide , are indeed attached to the HTML components generated by the RF framework. 正如组件指南中所解释的那样,四个CSS类确实附加到RF框架生成的HTML组件上。

There are 2 solutions for you: 有两种解决方案:

  1. Customize your CSS in order to extend the default properties of the four CSS classes. 自定义CSS以扩展四个CSS类的默认属性。 This way, you will have the rendering you want for this component. 这样,您将拥有此组件所需的渲染。
  2. Remove the CSS classes using JavaScript (not recommanded). 使用JavaScript删除CSS类(不推荐)。

The second solution can be achieved easily with some jQuery script: 使用一些jQuery脚本可以轻松实现第二个解决方案:

jQuery(document).ready(function() {
    jQuery(".rich-stglpanel").removeClass("rich-stglpanel");
    ...
});

(this means once the page is loaded, find all elements with CSS class rich-stglpanel and remove this class ). (这意味着一旦页面加载,找到CSS类 rich-stglpanel 所有元素 并删除此类 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM