Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery手风琴备选方案(无jQuery UI)_Javascript_Jquery - Fatal编程技术网

Javascript jQuery手风琴备选方案(无jQuery UI)

Javascript jQuery手风琴备选方案(无jQuery UI),javascript,jquery,Javascript,Jquery,因此,我有3个简单的列表,通过设置每个一个活动类来展开。在我将它的类设置为活动后,是否可以使它滑动或切换 看看这里:给你 代码 $('.title').live('click', function(e) { e.preventDefault(); if($(this).closest('li').hasClass('active')) return; var $this = $(this); $this.closest('ul').fin

因此,我有3个简单的列表,通过设置每个
  • 一个活动类来展开。在我将它的类设置为活动后,是否可以使它滑动或切换

    看看这里:

    给你

    代码

    $('.title').live('click', function(e)
    {
        e.preventDefault();
    
        if($(this).closest('li').hasClass('active'))
          return;
    
          var $this = $(this);
          $this.closest('ul').find('li.active')
          .find("div.description").slideUp(200, function(){
    
              $this.closest('ul').find('li.active').removeClass('active');
              $this.closest('li')
                  .find("div.description").slideDown(200, function(){
                     $(this).closest('li').addClass('active');
                  });
           });
    
    });
    

    你知道,第一次在slideDown上,它会立即显示出来,而不是看一看我编辑的答案。我也在这里创作了小提琴,我在用它。。。非常接近,但你抓住了我。再次非常感谢