Javascript 当“时,将箭头向后切换(0度)”;x";单击关闭图标

Javascript 当“时,将箭头向后切换(0度)”;x";单击关闭图标,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我一直在做一个手风琴,它接近我需要的样子。但是,我似乎无法在单击关闭“x”图标后将箭头旋转回0度。切换开关关闭,但箭头保持在向下位置 问题出在这一行: $(this).find('span').css('transform', 'rotate(0deg)'); 您正在X按钮内搜索箭头。您需要向上搜索2个元素,然后在那里搜索: 换行 $(this).find('span').css('transform', 'rotate(0deg)'); 与 $('#main').each(fu

我一直在做一个手风琴,它接近我需要的样子。但是,我似乎无法在单击关闭“x”图标后将箭头旋转回0度。切换开关关闭,但箭头保持在向下位置


问题出在这一行:

$(this).find('span').css('transform', 'rotate(0deg)');
您正在X按钮内搜索箭头。您需要向上搜索2个元素,然后在那里搜索:

换行

 $(this).find('span').css('transform', 'rotate(0deg)');

  $('#main').each(function () {
      var $accordian = $(this);
      $accordian.find('.view-m').on('click', function () {
          $accordian.find('.mobile-content-body').slideUp();
          $accordian.find('span').css('transform', 'rotate(0deg)');
          if (!$(this).next().is(':visible')) {
              $(this).next().slideDown();
              $(this).find('span').css('transform', 'rotate(90deg)');
              $(this).next().slideDown();
              $accordian.find('.close').click(function () {
                  $(this).parent().slideUp(500);
                  $(this).parent().parent().find('span').css('transform', 'rotate(0deg)');
              });
          }
      });
  });
 $(this).find('span').css('transform', 'rotate(0deg)');
 $(this).parent().prev('.view-m').find('span').css('transform', 'rotate(0deg)');