Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery与h3:before的一致头状态_Jquery_Css_Jquery Ui_Jquery Ui Accordion - Fatal编程技术网

Jquery与h3:before的一致头状态

Jquery与h3:before的一致头状态,jquery,css,jquery-ui,jquery-ui-accordion,Jquery,Css,Jquery Ui,Jquery Ui Accordion,我有一个Jquery手风琴,我想在标题前插入字体图标。目前在我的代码中,我有: .ui-accordion h3:before { font-family: 'FontAwesome'; content: '\f0da'; margin:0 5px 0 -15px; color: #000; padding-right:10px; } 它总是在手风琴的h3标题前显示右插入符号。但是,我希望它仅在默认模式下显示,ui-state-default,并希望在单

我有一个Jquery手风琴,我想在标题前插入字体图标。目前在我的代码中,我有:

.ui-accordion h3:before {
    font-family: 'FontAwesome';
    content: '\f0da';
    margin:0 5px 0 -15px;
    color: #000;
    padding-right:10px;
}
它总是在手风琴的
h3
标题前显示右插入符号。但是,我希望它仅在默认模式下显示,
ui-state-default
,并希望在单击标题或
.ui-state-active
时执行其他操作。当我尝试添加
.ui accordion.ui state default h3:before
代替
.ui accordion h3:before
时,右插入符号消失。如何在CSS中实现这一点

$('#YOURELEMENT li a').click(function(){
    $(this).next('ul').slideToggle('500');
    $(this).find('i').toggleClass('fa-plus-circle fa-minus-circle')
});
这将用另一个单击jquery的图标替换您的fontawesome图标\
尝试在HTML中动态添加字体而不是使用css,这会使事情变得复杂,因为我记得元素“ui accordion>h3”有自己的类“ui状态默认值”,所以正确的代码应该是:

.ui-accordion .ui-state-default:before {
  font-family: 'FontAwesome';
  content: '\f0da';
  margin:0 5px 0 -15px;
  color: #000;
  padding-right:10px;
}
也可以简单使用

.ui-state-default:before {
  //your_code
}

不,如果没有空格,它也会消失。在HTML中动态添加字体确实有效,但是因为我的手风琴中有很多标题,所以我尝试只使用CSS来选择它们。非常感谢!正是我想要的:)