jQuery-显示与隐藏不用判断的快捷方法

功能:显示被隐藏的元素,隐藏已显示的元素。

常规方法:(需要先判断元素状态)

$("button").click(function(){
            if ($(".content").css("display")=="none") 
                $(".bottom").show("slow");
            else
                $(".bottom").hide("slow");
        });

快捷方法:(自动判断)

$(".button").click(function(){
            $(".content").toggle("slow");
        });
原文地址:https://www.cnblogs.com/dreamsqin/p/9294103.html