我正在使用Jquery 手风琴制作手风琴。问题是,当用户单击加号或减号图标时,我想显示和隐藏内容面板,但它在标题单击时全部打开,并且切换在标题部分中的 chrome 和 safari 中不起作用,并且在内容部分工作任何帮助都应该得到解决. 代码-
<?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>