简体   繁体   English

dcAccordian问题有关wordpress中的展开崩溃

[英]dcAccordian issue on expand collapse in wordpress

hi there i am using dcAccordion jquery file for my plugin menu. 您好,我在插件菜单中使用dcAccordion jQuery文件。 I add a attribute for collapse and expand int he file and make a condition for it and use plus(+) minus(-) sign for it. 我为折叠添加了一个属性,然后将其扩展为文件并为其创建条件,并为其使用加号(+)减号(-)。

When i first time open the site the sign is showing me at the parent menu, now if i click the parent menu the plus sign converts into minus sign but when i click on the child menu the minus sign turned into plus sign again. 当我第一次打开站点时,该符号在父菜单中显示给我,现在如果我单击父菜单,则加号将转换为减号,但是当我单击子菜单时,该减号又变为加号。 don't know what is happening. 不知道发生了什么。

Here is my code: 这是我的代码:

Collapse/expand attribute in dcAccordion file dcAccordion文件中的折叠/展开属性

expandCollaps: true

Here is my condition 这是我的情况

// Here is my condition
if (defaults.expandCollaps == true) {
    $('li.' + classParentLi, obj).each(function() {
    var state = {
    collapse: '<span class="wpc-collapse"> (-)<span>',
    expand: '<span class="wpc-expand"> (+)</span>'
}
$(this).find('a').first().append(state.expand);
$(this).click(function() {
if ($(this).find('span').hasClass('wpc-collapse')) {
    $(this).find('span').remove();
    $(this).find('a').first().append(state.expand);
 } else {
     $(this).find('span').remove();
     $(this).find('a').first().append(state.collapse);
  }
});


});
 }

Ok I add this code in my plugin main page 好的,我将此代码添加到插件主页中

<?php
function wpc_accordiaon() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery('.wpc-categories li a.active').find('.wpc-expand').toggleClass('wpc-collapse');
        })
    </script>
<?php
}
?>

And my dcAccordion work perfectly 而且我的dcAccordion可以完美运行

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

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