how to select all class except the clicked element in JQuery?

前端 未结 3 2112
無奈伤痛
無奈伤痛 2020-12-02 07:46

I have a website developed on Drupal. I use a module called collapsiblock (it is basicly a JQuery plugin) to achieve accordion like effect. It is working fine with me (altho

3条回答
  •  悲&欢浪女
    2020-12-02 08:19

    Try this,This is a better way because if you use each function it will load and in the future when you have more than a thousand div it will take a long time to slide up and slide down.

    Example:

    $('.collapsiblock').click(function(){
       $('.collapsiblock').not(this).slideUp();
       $(this).slideDown();
    });
    

提交回复
热议问题