jq toggle() 状态切换

Posted ghfjj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jq toggle() 状态切换相关的知识,希望对你有一定的参考价值。

                // $(‘.cjwt_list .qbox‘).on(‘click‘,function(){
		// 	if($(this).next(‘.abox‘).is(‘:visible‘)){
		// 		$(this).removeClass(‘on‘);
		// 		$(this).next(‘.abox‘).stop(true,true).slideUp();
		// 	}else{
		// 		$(this).addClass(‘on‘);
		// 		$(this).next(‘.abox‘).stop(true,true).slideDown();
		// 	}
		// })



		$(‘.cjwt_list .qbox‘).on(‘click‘,function(){
			$(this).next(‘.abox‘).stop(true,true).slideToggle();
			$(this).toggleClass(‘on‘);
		})                    

  上下两段代码效果一样!!!

以上是关于jq toggle() 状态切换的主要内容,如果未能解决你的问题,请参考以下文章