
$(window).on('scroll', function () {
    var scroll = $(this).scrollTop();
    $('.part-pic').each(function () {
        var ot = $(this).offset().top;
        if (ot <= scroll + 1000) {
            if ($(this).parents('.page-1').attr("id") == "page-1"){
                showAnimation1(".page-1 .part-pic","animated swing",600);
            }
            if ($(this).parents('.page-2').attr("id") == "page-2"){
                showAnimation1(".page-2 .part-pic","animated rotateIn",600);
            }
            if ($(this).parents('.page-3').attr("id") == "page-3"){
                showAnimation1(".page-3 .part-pic","animated flip",400);
            }
            if ($(this).parents('.page-4').attr("id") == "page-4"){
                showAnimation1(".page-4 .part-pic","animated bounceInRight",200);
            }
            if ($(this).parents('.page-5').attr("id") == "page-5"){
                showAnimation1(".page-5 .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5a').attr("id") == "page-5a"){
                showAnimation1(".page-5a .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5b').attr("id") == "page-5b"){
                showAnimation1(".page-5b .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5c').attr("id") == "page-5c"){
                showAnimation1(".page-5c .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5d').attr("id") == "page-5d"){
                showAnimation1(".page-5d .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5e').attr("id") == "page-5e"){
                showAnimation1(".page-5e .part-pic","animated fadeInUp",400);
            }
            if ($(this).parents('.page-5f').attr("id") == "page-5f"){
                showAnimation1(".page-5f .part-pic","animated fadeInUp",200);
            }
            if ($(this).parents('.page-6').attr("id") == "page-6"){
                showAnimation1(".page-6 .part-pic","animated bounceIn",800);
            }
            if ($(this).parents('.page-7').attr("id") == "page-7"){
                showAnimation1(".page-7 .part-pic","animated bounceInLeft",300);
            }
            if ($(this).parents('.page-8').attr("id") == "page-8"){
                showAnimation1(".page-8 .part-pic","animated flipInY",400);
            }
            if ($(this).parents('.page-9').attr("id") == "page-9"){
                showAnimation1(".page-9 .part-pic","animated rollIn",400);
            }
            if ($(this).parents('.page-01').attr("id") == "page-01"){
                showAnimation1(".page-01 .part-pic","animated slideInLeft",300);
            }
            if ($(this).parents('.page-02').attr("id") == "page-02"){
                showAnimation1(".page-02 .part-pic","animated slideInRight",300);
            }
        }
    });
});


/*刷新加载动画*/
/*
$(function()  {
    $('.part-pic').each(function () {
            if ($(this).parents('.page-7').attr("id") == "page-7"){
                showAnimation1(".page-7 .part-pic","animated bounceInLeft",200);
            }
    });
});*/

function showAnimation1(index,animated,time){
    setTimeout(function () {
        var $this =  $(index).eq(0);
        $this.addClass(animated);
        $this.css("opacity","1");
        setTimeout(function () {
            var $this =  $(index).eq(1);
            $this.addClass(animated);
            $this.css("opacity","1");
            setTimeout(function () {
                var $this =  $(index).eq(2);
                $this.addClass(animated);
                $this.css("opacity","1");
                setTimeout(function () {
                    var $this =  $(index).eq(3);
                    $this.addClass(animated);
                    $this.css("opacity","1");
                    setTimeout(function () {
                        var $this =  $(index).eq(4);
                        $this.addClass(animated);
                        $this.css("opacity","1");
                        setTimeout(function () {
                            var $this =  $(index).eq(5);
                            $this.addClass(animated);
                            $this.css("opacity","1");
                            setTimeout(function () {
                                var $this =  $(index).eq(6);
                                $this.addClass(animated);
                                $this.css("opacity","1");
                                setTimeout(function () {
                                    var $this =  $(index).eq(7);
                                    $this.addClass(animated);
                                    $this.css("opacity","1");
                                    setTimeout(function () {
                                        var $this =  $(index).eq(8);
                                        $this.addClass(animated);
                                        $this.css("opacity","1");
                                    },time);
                                },time);
                            },time);
                        },time);
                    },time);
                },time);
            },time);
        },time);
    },time);
}