jquery 实现切换效果,划入滑出,slideToggle

    $(function() {
        $("#target").click(function(){
            var togglearea = $(this);
            if(!togglearea.next().is(":animated")){//Used to judge the animation is implementing or not
                //This if statement is used to make the animation is more smooth, if the toggled class didn't have any css style related to marign or padding, you can just use the first if statement.
                if(togglearea.attr("class")=="origin"){
                    togglearea.toggleClass("origin").next().slideToggle("slow");
                }
                else{
                    togglearea.next().slideToggle("slow", function(){togglearea.toggleClass("origin");});
                }
            }
            return false;
        });
    });
posted @ 2011-11-30 22:59  Simon_Chen  阅读(2905)  评论(0编辑  收藏  举报