How do I compare two jQuery objects for identity?

后端 未结 3 1569
谎友^
谎友^ 2020-12-01 13:36

I\'m trying to use jQuery to open / close control \'boxes\' on a webpage. Unfortunately, it doesn\'t look very good to close a box just to re-open it if the user happens to

3条回答
  •  一整个雨季
    2020-12-01 14:12

    Try this:

    function openBox(index)
    {
    val=$('#box'+index);
    $('.profilePageContentBox').each(function(){
        if($(this).is(":visible"))
        {
            if(!$(this).is("#box"+index))
                $(this).slideToggle(200);
        }
    });
    val.slideToggle(200);
    }
    

提交回复
热议问题