![](https://i-blog.csdnimg.cn/blog_migrate/924dc91cfb99aa03a2fe2f63d90b14a3.png)
展开效果:
![](https://i-blog.csdnimg.cn/blog_migrate/041ed6ce5920a2d2a5fef60eca31e8d2.png)
折叠效果
![](https://i-blog.csdnimg.cn/blog_migrate/6545d9839eb2ac216fdf975062d63819.png)
js:
var show1 = $('.zyu-gjstxx .zyu-hd .span3');
var height = $('.zyu-gjstxx .zyu-bd');
var span2 = $('.zyu-gjstxx .zyu-hd .span2');
console.log(show1);
let index = $(this).index();
console.log(index);
show1.click(function () {
$(this).parent().next().slideToggle("fast");
if ($(this).html() == '收起') {
$(this)[0].innerHTML = '展开';
$(this).prev().css({ 'transform': 'rotate(180deg)' });
}
else {
$(this)[0].innerHTML = '收起';
$(this).prev().css({ 'transform': 'rotate(0)' });
}
});