我正在使用Jquery手风琴来制作手风琴。问题是当用户点击加号或减号图标时,我想显示和隐藏内容面板,但它会在头部点击时全部打开,并且切换在Chrome和Safari的头部部分无法工作,在内容部分可以工作。任何帮助将不胜感激。
< img alt="输入图像描述" src="https://istack.dev59.com/wzLtL.webp"/>
代码-
<?php
$cs=Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.min.js', CClientScript::POS_HEAD);
$cs->registerScriptFile('http://code.jquery.com/ui/1.10.3/jquery-ui.js', CClientScript::POS_HEAD);
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/toggles.min.js', CClientScript::POS_HEAD);
$cs->registerCssFile('http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css');
$cs->registerCssFile(Yii::app()->baseUrl . '/css/themes/toggles-light.css');
$cs->registerCssFile(Yii::app()->baseUrl . '/css/toggles.css');
?>
css-
<style>
.ui-accordion-header {
background:none;
}
.ui-accordion-content {
background:none;
}
.iconOpen {
background:url('<?php echo Yii::app()->request->baseUrl; ?>/img/minus.png') no-repeat !important;
background-size:46px !important;
width:46px;
height:44px;
}
.iconClosed {
background:url('<?php echo Yii::app()->request->baseUrl; ?>/img/plus.png') no-repeat !important;
background-size:46px !important;
width:46px;
height:44px;
}
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
top: 25%;
left: 0.0em;
margin-top: -12px;
}
.ui-accordion .ui-accordion-icons {
padding-left: 4.2em;
}
.ui-accordion .ui-accordion-header {
margin-top: 0px;
height: 26px !important;
}
</style>
js-
<script>
$(function() {
var icons = {
header: "iconClosed", // custom icon class
activeHeader: "iconOpen" // custom icon class
};
$( "#main_accordion" ).accordion({
icons: icons,
collapsible: true,
heightStyle: "content"
});
$('.toggle').toggles({clicker:$('.clickme')});
});
</script>
Html:-
<div id="main_accordion">
<h3>R
<div align="right" style=" margin-top: -16px;">
<div class="toggle-light">
<div class="toggle"></div>
</div>
</div>
</h3>
<div>
<p>interface</p>
</div>
<h3>F
<div align="right" style=" margin-top: -16px;">
<div class="toggle-light">
<div class="toggle"></div>
</div>
</div>
</h3>
<div>
<p> Feed Back
<div class="toggle-light">
<div class="toggle"></div>
</div>
</p>
</div>
</div>