English 中文(简体)
j Query Agreement menu - Toggle Icon Triger
原标题:jQuery Accordion menu - Toggle Icon Triger

在联合材料中,我不喜欢,我需要一些帮助。

我试图使Icon成为一种触发因素。 Icon应当改为(Open - / 近+)。 我把“活性”类分解成触发器。

可在行动

传真:

<div class="acc_menu">

    <div class="acc_menu_item">
                <div class="acc_menu_title">                    
                    <h3><a href="#">CAT 1</a></h3>
                    <span class="ico"></span>
                </div>
                <div class="acc_menu_sub">
                    <ul>
                        <li><a href="#">Sub cat 1-1</a></li>
                        <li><a href="#">Sub cat 1-2</a></li>
                        <li><a href="#">Sub cat 1-3</a></li>
                    </ul>
                </div>
    </div>
    <div class="acc_menu_item">
                <div class="acc_menu_title">                   
                    <h3><a href="#">CAT 2</a></h3>
                    <span class="ico"></span>
                </div>
                <div class="acc_menu_sub">
                    <ul>
                        <li><a href="#">Sub cat 2-1</a></li>
                        <li><a href="#">Sub cat 2-2</a></li>
                        <li><a href="#">Sub cat 2-3</a></li>
                    </ul>
                </div>
    </div>

    <div class="acc_menu_item">
                <div class="acc_menu_title">                   
                    <h3><a href="#">CAT 3</a></h3>
                    <span class="ico"></span>
                </div>
                <div class="acc_menu_sub">
                    <ul>
                        <li><a href="#">Sub cat 3-1</a></li>
                        <li><a href="#">Sub cat 3-2</a></li>
                        <li><a href="#">Sub cat 3-3</a></li>
                    </ul>
                </div>
    </div>
</div>

JQuery:

$(".acc_menu_sub").hide();

$(".acc_menu_title .ico").toggle(function(){
        $(this).addClass("active");
}, function () {
        $(this).removeClass("active");
});

$(".acc_menu div div .ico").click(function(){
        if(false == $(this).parent().parent().children(".acc_menu_sub").is( :visible )) {
            $( .acc_menu .acc_menu_sub ).slideUp(300, easeInQuad );
        }        
        $(this).parent().parent().children(".acc_menu_sub").slideToggle(300, easeInQuad );
});

但是,问题在于,我可以说明如何使其工作正确。 当我点击不活跃的菜单时,该活动正在关闭,但伊科公司没有变化。

Thanks, Serghey

<<>strong>SOLVED:

$(".acc_menu_sub").hide();     

    $(".acc_menu div div .ico").click(function(){        
        if(false == $(this).parent().parent().children(".acc_menu_sub").is( :visible )) {
            $(".acc_menu div div .ico").removeClass("active");
            $(this).addClass("active");
            $( .acc_menu .acc_menu_sub ).slideUp(300, easeInQuad ).removeClass("active");                
        }        
        $(this).parent().parent().children(".acc_menu_sub").slideToggle(300, easeInQuad );
});
最佳回答
问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签