jQuery - 下一段

jQuery - Next paragraph

在这种情况下如何使用 'next'?没用...

var that = $( ".class" ).next( "p" );
if (that.hasClass('active')) {

            that.slideUp('slow', function () {

                that.removeClass('active');

            });
        } 

这应该显示案例:https://jsfiddle.net/4Lmuydak/

您需要将点击事件附加到 h3 元素,然后切换下一个同级 p 元素的可见性:

$('h3').click(function(){
    $(this).next('p').slideToggle('slow',function(){
       $(this).toggleClass("active")
    })
});

Working Demo