var type_id = 1;
window.map_mp3_1=1;
window.map_mp3_2=1;
window.map_mp3_3=1;
window.map_mp3_4=1;
window.map_mp3_5=1;
window.map_mp3_6=1;
window.map_mp3_7=1;
window.map_mp3_8=1;
window.map_mp3_9=1;
window.map_mp3_10=1;
$(document).ready(function () {
    var clickEvent = $.isFunction($.fn.tap) ? 'tap' : 'click';
    $('.btn-home').on(clickEvent, function () {
        $('.btn-home').hide();
        $('.btn-a-x').show();
        setTimeout(function () {
            $('.page-game').hide();
            $('.page-through').show();
        },1500);

        setTimeout(function () {
            $('.page-through').hide();
            $('.page-long').show();
            // $('.music-open').hide();
            // $('.music-close').show();
            // $('#b-j').get(0).pause();
        }, 5500);

    });
    $('.btn-rule').on(clickEvent, function () {
        $('.rule-map').show();

    });

    $('.music-open').click(function(){
        $('.music-open').hide();
        $('.music-close').show();
        $('#b-j').get(0).pause();
    });
    $('.music-close').click(function(){
        $('.music-open').show();
        $('.music-close').hide();
        $('#b-j').get(0).play();
    });
    $('.btn-share').on(clickEvent,function () {
        $('.dialog-share').show();
    });
    $('.dialog-share').on(clickEvent,function () {
        $(this).hide();
    });

    $('input').on('blur',function(){
        window.scroll(0,0);
    });
    var prize_lock = true;
    $('.btn-prize').on(clickEvent, function () {
        if (!prize_lock) {

            return;
        }
        $('.page-h-b').hide();
        $('.page-prize-proceed').show();
        prize_lock = false;
        $.ajax({
            url: '/index/get_prize',
            type: 'post',
            data: {
                'photo_url':$('.h-b').attr('src')
            },
            success: function (resp) {
                setTimeout(function () {
                    prize_lock = true;
                    $('.page-prize-proceed').hide();
                    if (resp.errcode == 0) {
                        if (resp.data.prize_type == 0) {
                            $('.dialog-no-prize').show();
                        }else {
                            $('.yes-prize').attr('src','Public/static/images/yes-prize-' + resp.data.prize_id + '.png');
                            $('.dialog-prize').show();

                            if(resp.data.info_type==0 || resp.data.info_type==2){
                                $('.btn-submit').show();
                            }else {
                                $('.dialog-prize input').attr('disabled','disabled');
                                $('.btn-submit').addClass('lock').show();
                                $('.name').val(resp.data.name);
                                $('.tel').val(resp.data.tel);
                                $('.address').val(resp.data.address);
                            }
                            if(resp.data.info_type==2 || resp.data.info_type==1){
                                my_notify('你已中过奖');
                            }
                        }
                    }
                }, 2500);

            }
        });
    });
    $('.map-21,.map-22').on(clickEvent, function () {
        $('.page-long').hide();
        $('.page-m-b').show();
        // $('.music-open').show();
        // $('.music-close').hide();
        // $('#b-j').get(0).play();
        var mySwiper = new Swiper('.swiper-container', {
            navigation: {
                nextEl: '.btn-left',
                prevEl: '.btn-right'
            },
            on: {
                slideChangeTransitionEnd: function () {
                    type_id = parseInt(this.activeIndex + 1);
                    if(type_id==4){
                        $('.btn-left').hide();
                    }else if(type_id==1){
                        $('.btn-right').hide();

                    }else {
                        $('.btn-left').show();
                        $('.btn-right').show();
                    }
                }
            }

        });
    });
    $('.btn-close').on(clickEvent, function () {
        $('.rule-map').hide();
    });

    var countDown = 0;
    var record = 0;
    var topClass = $('.page-long');
    var countY;
    const app = document.querySelector('.touchSlide');
    const hammertime = new Hammer(app);
    hammertime.on('panup', function (ev) {
            $('.arrow').hide();
            $('.astronaut').show();
        if (topClass.offset().top <= -12009) {
            return;
        }
        topClass.animate({
            top:parseInt(countDown + ev.deltaY)
        }, 0);

        animateShow();
        record = parseInt(countDown + ev.deltaY)
    });
    hammertime.on('pandown', function (ev) {
        if (parseInt(topClass.offset().top) >= 0) {
            return;
        }
        topClass.animate({
            top: Math.max(parseInt(countDown + ev.deltaY))
        }, 0);

        record = Math.max(parseInt(countDown + ev.deltaY));
        animateShow()
    });
    var side_lock=true;
    var number=1;
    hammertime.on('panend', function (ev) {
        countDown = record;

        //
        if (ev.deltaY >= 0 || topClass.offset().top <= -12009 || parseInt(topClass.offset().top) >= 0) {
            return;
        }
        var num;

        countY = ev.deltaY / parseInt($('html').css('fontSize'));
        if (ev.deltaY < 0) {
            num = parseInt($('.page-long').offset().top + countY);
        } else {
            num = parseInt($('.page-long').offset().top + countY);
        }

        // //
        if(!side_lock){
            if(number==1){
                number=2;
                setTimeout(function () {
                    number=1;
                    side_lock=true;
                },300);
            }

            return;
        }

        // countDown = parseInt(record+num);
        topClass.animate({
            top: num
        }, 300, 'easeOutCubic');
        side_lock=false;
    });
    hammertime.get('pan').set({direction: Hammer.DIRECTION_ALL});
    $('.btn-submit').on(clickEvent, function () {
        if($(this).hasClass('lock')){
            my_notify('亲，你已提交过信息');
            return;
        }
        var name = $('.name').val();
        var tel = $('.tel').val();
        var address = $('.address').val();
        if (name.match(/^\s*$/)) {
            my_notify('请填写姓名哦！');
            return false;
        }
        if (!tel.match(/^1\d{10}$/)) {
            my_notify('手机号好像不对～');
            return false;
        }
        if(!address){
            my_notify('请输入地址');
            return false;
        }
        $.ajax({
            url: '/index/addInfo',
            type: 'post',
            data: {
                "name":name,
                "tel":tel,
                "address":address
            },
            success: function (resp) {
                if(resp.errcode==0){
                    my_notify('提交成功');
                $('.btn-submit').addClass('lock');
                  $('.dialog-prize input').attr('disabled','disabled');
                }
            }
        });
    });

    $('.btn-1').on(clickEvent, function () {
        $('.btn-s-c')[0].click();
    });
    $('.btn-2').on(clickEvent, function () {
        $('.page-updata').hide();
        $('.page-m-b').show();
    });
    $('.btn-s-c').change(function (e) {
        imgInfo.rotation = 0;
        imgInfo.x = 0;
        imgInfo.y = 0;
        imgInfo.scale = 1;
        e.preventDefault();
        var imgData = this.files[0];
        EXIF.getData(imgData, function () {
            var orientation = EXIF.getTag(this, "Orientation");
            switch (orientation) {
                case 3:
                    imgInfo.rotation = 180;
                    break;
                case 6:
                    imgInfo.rotation = 90;
                    break;
                case 8:
                    imgInfo.rotation = 270;
                    break;
                default:
                    imgInfo.rotation = 0;
            }
            if (navigator.userAgent.indexOf('iPhone') > -1) {
                imgInfo.rotation = 0;
            }
            lrz(imgData, {width: 640}, function (results) {
                img = new Image();
                img.onload = function () {
                    results = null;
                    imgData = null;
                    console.log('onload success');
                    $('.t-c').attr('src', 'Public/static/images/t-' + type_id + '.png');
                    $('.page-updata').show();
                    $('.page-m-b').hide();
                    drawImage();

                    window.setted = true;
                };
                img.src = results.base64;
                window_img_url = results.base64;
            });
        });
        $(this).val('');
        return false;
    });
    var img;

    var imgInfo = {};
    var canvas;
    var mc = new Hammer($('.t-c').get(0));

    mc.get('pan').set({direction: Hammer.DIRECTION_ALL});
    mc.get('pinch').set({enable: true});
    mc.get('rotate').set({enable: true});

    var oldpoz = {};
    var drawFinish = false;
    mc.on('panstart panmove panend', function (event) {
        if (drawFinish) {
            return;
        }
        if (event.type == 'panstart' || event.type == 'panend') {
            oldpoz.x = 0;
            oldpoz.y = 0;
            imgInfo.startX = imgInfo.x;
            imgInfo.startY = imgInfo.y;
        } else {
            var movedX = (event.deltaX - oldpoz.x);
            var movedY = (event.deltaY - oldpoz.y);
            oldpoz.x += event.deltaX;
            oldpoz.y += event.deltaY;
            imgInfo.x = imgInfo.startX + event.deltaX;
            imgInfo.y = imgInfo.startY + event.deltaY;
            console.log(event.deltaX, event.deltaY);
            drawImage();
        }
        console.log(event.type);
    });
    var oldScale = 1;
    mc.on('pinchstart pinchmove pinchend', function (event) {
        if (drawFinish) {
            return;
        }
        if (event.type == 'pinchstart' || event.type == 'pinchend') {
            imgInfo.oldScale = imgInfo.scale;
        } else {
            var nowScale = event.scale / oldScale;
            oldScale = event.scale;
            imgInfo.scale = imgInfo.oldScale * event.scale;
            drawImage();
        }

    });
    var oldRotation = 0;
    mc.on('rotatestart rotatemove rotateend', function (event) {
        if (drawFinish) {
            return;
        }
        if (event.type == 'rotatestart' || event.type == 'rotateend') {
            oldRotation = 0;
            imgInfo.startRotation = imgInfo.rotation;
        } else {
            nowRotation = event.rotation - oldRotation;
            oldRotation = event.rotation;
            imgInfo.rotation = imgInfo.startRotation + event.rotation;
            drawImage();
        }
    });
    var drawImage = function () {
        initCanvas();
        context.save();

        context.clearRect(0, 0, canvas.width, canvas.height);
        context.translate(canvas.width / 2, canvas.height / 2);
        context.translate(imgInfo.x, imgInfo.y);
        context.rotate(Math.PI / 180 * imgInfo.rotation);
        context.scale(imgInfo.scale, imgInfo.scale);
        context.drawImage(img, -img.width / 2, -img.height / 2);
        context.restore();
    };
    var initCanvas = function (id) {
        canvas = $('canvas').get(0);
        context = canvas.getContext("2d");
        canvas.width = 385;
        canvas.height = 385;
        context.fillStyle = '#f7be9d';
        context.fillRect(0, 0, canvas.width, canvas.height);
    };

    function mergeImage() {

        var tmp = $('<canvas></canvas>')[0];
        tmp.width = 385;
        tmp.height = 385;
        canvas.left = 0;
        canvas.top = 0;
        var ctx = tmp.getContext('2d');
        ctx.drawImage(canvas, canvas.left, canvas.top);
        return tmp.toDataURL('image/jpeg', 0.1);
    }

    function mergeImage_two() {
        var cover = new Image();
        var cover_three = new Image();
        var url_three = 'Public/static/images/h-' + type_id + '.png?t=1';
        var url_two_t = mergeImage();
        cover.src = url_two_t;
        cover_three.src = url_three;
        cover_three.onload = function () {

        // cover.onload = function () {

            var tmp = $('<canvas></canvas>')[0];
            tmp.width = 640;
            tmp.height = 1238;
            // cover.width=200;
            // cover.height=200;
            cover_three.width = 640;
            cover_three.height = 1238;
            var ctx = tmp.getContext('2d');
            // tmp.crossOrigin = "*";

            ctx.drawImage(cover, 124, 360);
            ctx.drawImage(cover_three, 0, 0);
            setTimeout(function () {
                $('.h-b').attr('src', tmp.toDataURL('image/jpeg', 0.6));
                $('.page-updata').hide();
                $('.page-h-b').show();
                $('.page_checking').hide();
            }, 1000);
        }
        // }
    }

    $('.btn-3').on(clickEvent, function () {
        $('.page_checking').show();
        mergeImage_two();
    });
});
function animateShow() {
    var mp3_1=1;
    var pageTop = parseInt(-$('.page-long').offset().top);
    console.log(pageTop);
    if (pageTop >= 20 && pageTop < 110) {
        var count_0;
        if (parseInt(Math.min(((pageTop-20) * 7.2))) > 539) {
            count_0 =0;
        } else {
            count_0 = -parseInt(539 - Math.min(((pageTop-20) * 7.2)))
        }
        if (count_0 < 0) {
            $('.qiu').removeClass('qiu_d-h');
        } else {
            $('.qiu').addClass('qiu_d-h');
        }
        $('.map-1').animate({
            left: count_0
        }, 0);

        $('.astronaut').animate({
            left: (pageTop - 20) * 2.988 + 243,
            top: (pageTop - 20) * 5
        }, 0);
    } else {
        if (pageTop > 110) {
            $('.map-1').animate({
                left: 0
            }, 0);
            $('.qiu').addClass('qiu_d-h');
            $('.astronaut').animate({
                left: 512,
                top: 450
            }, 0);
            if(window.map_mp3_9==1){
                window.map_mp3_9=2;
                document.getElementById('y-x').pause();
                    // document.getElementById('y-x').play();
                    $('#y-x').attr('src','Public/static/audio/9.mp3');
                    document.getElementById('y-x').play();




            }
        }else {

            window.map_mp3_9=1;
        }
    }

    if (pageTop >= 240 && pageTop < 1101) {

        var count_1;
        if (parseInt(Math.min(((pageTop - 240) * 0.55))) > 438) {

            count_1 = 192;
        } else {
            count_1 = parseInt(630 - Math.min(((pageTop - 240) * 0.55)))
        }
        if (count_1 <= 192) {

            $('.d-l').show();
            $('.cat').addClass('cat-d-h')
        } else {
            $('.d-l').hide();
            $('.cat').removeClass('cat-d-h')
        }
        $('.map-2').animate({
            left: count_1
        }, 0);
        $('.astronaut').animate({
            left: (pageTop - 240) * -0.569 + 512
        }, 0);
        if(pageTop>800){
            if(window.map_mp3_10==1){
                window.map_mp3_10=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/10.mp3');
                document.getElementById('y-x').play();

            }

        }

    } else {


        if (pageTop > 1101) {
            $('.map-2').animate({
                left: 192
            }, 0);
            $('.d-l').show();
            $('.astronaut').animate({
                left: 22
            }, 0);
            // if(window.map_mp3_10==1){
            //     window.map_mp3_10=2;
            //     document.getElementById('y-x').pause();
            //     $('#y-x').attr('src','Public/static/audio/10.mp3');
            //     document.getElementById('y-x').play();
            //
            // }
            $('.cat').addClass('cat-d-h');

        }else {

            window.map_mp3_10=1
        }

    }

    if (pageTop >= 1111 && pageTop < 1552) {
        var count_2;
        if (parseInt(Math.min(((pageTop - 1111) * 0.91))) > 395) {
            count_2 = 0;
        } else {
            count_2 = -parseInt(395 - Math.min(((pageTop - 1111) * 0.91)));
        }
        $('.map-3').animate({
            left: count_2
        }, 0);

    } else {

        if (pageTop > 1552) {
            $('.map-3').animate({
                left: 0
            }, 0);
            if(window.map_mp3_1==1){
                window.map_mp3_1=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/1.mp3');
                document.getElementById('y-x').play();
            }
        }else {
            window.map_mp3_1=1;
        }

    }
    if (pageTop >= 1650 && pageTop < 1857) {

        var count_3;

        if (parseInt((Math.min(((pageTop - 1650) * 1.2)))) > 244) {
            count_3 = 389;
        } else {
            count_3 = parseInt(634 - (Math.min(((pageTop - 1650) * 1.2))))
        }

        $('.map-4').animate({
            left: count_3
        }, 0);
    } else {
        if (pageTop > 1857) {
            $('.map-4').animate({
                left: 389
            }, 0);

        }
    }
    if (pageTop >= 1942 && pageTop < 2239) {

        var count_4;

        if (parseInt((Math.min(((pageTop - 1942) * 1.9)))) > 531) {
            count_4 = 99;
        } else {
            count_4 = parseInt(630 - (Math.min(((pageTop - 1942) * 1.9))))
        }
        $('.map-5').animate({
            left: count_4
        }, 0);
        // document.getElementById('y-x').pause();
    } else {

        if (pageTop > 2239) {
            $('.map-5').animate({
                left: 99
            }, 0);

        }
    }

    if (pageTop >= 2336 && pageTop < 2742) {

        var count_5;
        if (parseInt((Math.min(((pageTop - 2336) * 1.59)))) > 630) {
            count_5 = 0;

        } else {
            count_5 = -parseInt((630 - Math.min(((pageTop - 2336) * 1.59))))

        }
        if (count_5 < 0) {
            $('.map-6').removeClass('map-6-d-h');

        } else {

            $('.map-6').addClass('map-6-d-h');
        }
        $('.map-6').animate({
            left: count_5
        }, 0);
    } else {
        if (pageTop > 2742) {

            $('.map-6').animate({
                left: 0
            }, 0);
            $('.map-6').addClass('map-6-d-h');
            if(window.map_mp3_2==1){
                window.map_mp3_2=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/2.mp3');
                document.getElementById('y-x').play();

            }
        }else {

            window.map_mp3_2=1;
        }

    }

    if (pageTop >= 2770 && pageTop < 2993) {
        var count_6;
        if (parseInt((Math.min(((pageTop - 2770) * 1.8)))) > 361) {
            count_6 = 269;
        } else {
            count_6 = parseInt((632 - Math.min(((pageTop - 2770) * 1.8))))
        }
        $('.map-7').animate({
            left: count_6
        }, 0);
    } else {
        if (pageTop > 2993) {

            $('.map-7').animate({
                left: 269
            }, 0);
            if(window.map_mp3_3==1){
                window.map_mp3_3=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/3.mp3');
                document.getElementById('y-x').play();

            }
        }else {
            window.map_mp3_3=1
        }

    }
    if (pageTop >= 3103 && pageTop < 4086) {
        var count_7;
        var count_map;
        if (parseInt((Math.min(((pageTop - 3103) * 0.68)))) > 640) {
            count_7 = 0;
            count_map=0
        } else {
            count_7 = -parseInt((640 - Math.min(((pageTop - 3103) * 0.68))))
            count_map=parseInt((640 - Math.min(((pageTop - 3103) * 0.68))))
        }
        if(count_7<0){
            $('.map-8').removeClass('map-8-d-x')
        }else {
            $('.map-8').addClass('map-8-d-x')
        }
        $('.map-8').animate({
            left: count_7
        }, 0);
        $('.map-8-2').animate({
            left: count_map
        }, 0);
    } else {

        if (pageTop > 4086) {
            $('.map-8').addClass('map-8-d-x')
            $('.map-8').animate({
                left: 0
            }, 0);
            $('.map-8-2').animate({
                left: 0
            }, 0);
            if(window.map_mp3_4==1){
                window.map_mp3_4=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/4.mp3');
                document.getElementById('y-x').play();

            }
        }else {
            window.map_mp3_4=1;
        }
    }
    if (pageTop >= 4248 && pageTop < 4714) {
        // console.log(parseInt((Math.min(((pageTop - 4248) * 1.3)))));
        var count_8;
        if (parseInt((Math.min(((pageTop - 4248) * 1.3)))) > 592) {
            count_8 = 47;
        } else {
            count_8 = parseInt((617 - Math.min(((pageTop - 4248) * 1.3))))
        }
        $('.map-9').animate({
            left: count_8
        }, 0);
    } else {

        if (pageTop > 4714) {

            $('.map-9').animate({
                left: 47
            }, 0);
        }
    }
    if (pageTop >= 4877 && pageTop < 5379) {

        $('.map-10').animate({

            left: parseInt((630 - Math.min(((pageTop - 4877) * 1.15))))
        }, 0);
        document.getElementById('y-x').pause();
    } else {
        if (pageTop > 5379) {

            $('.map-10').animate({

                left: 81
            }, 0);

        }
    }
    if (pageTop >= 5554 && pageTop < 6010) {

        var count_22;
        if (parseInt(Math.min(((pageTop - 5554) * 1.4))) > 390) {
            count_22 = 115;
        } else {
            count_22 = -parseInt((505 - Math.min(((pageTop - 5554) * 1.4))))
        }
        if(count_22<390){

            $('.map-11').removeClass('map-11-d-h')
        }else {

            $('.map-11').addClass('map-11-d-h')
        }
        $('.map-11').animate({

            left: count_22
        }, 0);

    } else {
        if (pageTop > 6010) {
            $('.map-11').animate({

                left: 115
            }, 0);
            $('.map-11').addClass('map-11-d-h');
            if(window.map_mp3_5==1){
                window.map_mp3_5=2;
                // document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/5.mp3');
                document.getElementById('y-x').play();

            }
        }else {

            window.map_mp3_5=1;
        }

    }
    if (pageTop >= 6100 && pageTop < 6881) {
        // console.log(parseInt((Math.min(((pageTop - 6097) * 1.19)))))
        var count_20;
        console.log(Math.min(((pageTop - 6100) * 0.78)));
        if (parseInt(Math.min(((pageTop - 6100) * 0.78))) > 614) {
            count_20 = 14;
        } else {

            count_20 =parseInt((628 - Math.min(((pageTop - 6100) * 0.78))))
        }
        $('.map-12').animate({
            left: count_20
        }, 0);
        // document.getElementById('y-x').pause();
    } else {
        if (pageTop > 6881) {
            $('.map-12').animate({

                left: 14
            }, 0);

        }

    }
    if (pageTop >= 6860 && pageTop < 7255) {
        var count_23;
        if (parseInt(Math.min(((pageTop - 6860) * 1.1))) > 390) {
            count_23 = 230;
        } else {
            count_23 =parseInt((620 - Math.min(((pageTop - 6860) * 1.1))))
        }
        if(count_23<390){

            $('.map-13').removeClass('map-13-d-h')
        }else {

            $('.map-13').addClass('map-13-d-h')
        }
        $('.map-13').animate({
            left: count_23
        }, 0);
    } else {


        if (pageTop > 7255) {

            $('.map-13').animate({
                left: 230
            }, 0);

            $('.map-13').addClass('map-13-d-h');
            if(window.map_mp3_6==1){
                window.map_mp3_6=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/6.mp3');
                document.getElementById('y-x').play();

            }
        }else {


            window.map_mp3_6=1;
        }
    }
    if (pageTop >= 7337 && pageTop < 8085) {
        // 340px
        var count_24;

        console.log("帅:"+Math.min(((pageTop - 7337) * 0.43)));
        if (parseInt(Math.min(((pageTop - 7337) * 0.43))) > 300) {
            count_24 = 340;
        } else {
            count_24 =parseInt((640 - Math.min(((pageTop - 7337) *0.43))))
        }
        if(count_24<300){

            $('.s-j').removeClass('s-j-d-h')
        }else {

            $('.s-j').addClass('s-j-d-h')
        }

        $('.map-14').animate({

            left: -parseInt((640 - Math.min(((pageTop - 7337) * 0.9))))
        }, 0);
        $('.s-j').animate({
            left:count_24
        }, 0);

    } else {
        if (pageTop > 8085) {
            $('.map-14').animate({
                left: 0
            }, 0);
            $('.s-j').animate({
                left: 340
            }, 0);
            $('.s-j').addClass('s-j-d-h')
        }
    }
    if (pageTop >= 8662 && pageTop < 8900) {

        var scale = (pageTop - 8662) * 0.0042;
        var count;
        if (parseInt((Math.min(((pageTop - 8662) * 1.6806)))) >= 400) {

            count = 0
        } else {
            count = -parseInt((400 - Math.min(((pageTop - 8662) * 1.6806))))

        }

        $('.map-15').animate({
            left: count
        }, 0);
        $(".map-15").get(0).style.webkitTransform = "scale(" + scale + ")";
        // $('.map-15').css('-webkit-transform',parseInt((Math.min(((pageTop - 8278) *0.002)))))

        $(".map-15-hand").get(0).style.opacity = scale;
        if(scale>=0.9){

            $(".map-15-hand").addClass('map-15-hand-d-h')
        }else {

            $(".map-15-hand").removeClass('map-15-hand-d-h')
        }
    } else {

        $(".map-15-hand").addClass('map-15-hand-d-h')
        if (pageTop > 8900) {
            $('.map-15').animate({
                left: 0
            }, 0);
            $(".map-15").get(0).style.webkitTransform = "scale(" + 1 + ")";
            $(".map-15-hand").get(0).style.opacity = 1;
            if(window.map_mp3_7==1){
                window.map_mp3_7=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/7.mp3');
                document.getElementById('y-x').play();

            }
        }else {
            window.map_mp3_7=1;
        }
    }
    if (pageTop >= 9721 && pageTop < 10355) {

        var count_17;
        if (parseInt((Math.min(((pageTop - 9721) * 0.6)))) >= 546) {

            count_17 = 172
        } else {
            count_17 = -parseInt((374 - Math.min(((pageTop - 9721) * 0.8))))

        }
        $('.map-17').animate({
            left: count_17
        }, 0);
        $('.h-y').animate({
            left: count_17 - 11
        }, 0);
        // document.getElementById('y-x').pause();
    } else {
        if (pageTop > 10355) {
            $('.map-17').animate({
                left: 172
            }, 0);

            $('.h-y').animate({
                left: 160
            }, 0);

        }
    }
    if (pageTop >= 9065 && pageTop < 9673) {

        var count_16;
        if (Math.min(((pageTop - 9065) * 1.14)) >= 640) {
            count_16 = 0

        } else {

            count_16 = -parseInt((640 - Math.min(((pageTop - 9065) * 1.14))))
        }
        if (count_16 >= 0) {

            $(".map-16").addClass('map-16-d-h')
        } else {
            $(".map-16").removeClass('map-16-d-h')
        }


    } else {

        if (pageTop > 9673) {
            $(".map-16").addClass('map-16-d-h')
            if(window.map_mp3_8==1){
                window.map_mp3_8=2;
                document.getElementById('y-x').pause();
                $('#y-x').attr('src','Public/static/audio/8.mp3');
                document.getElementById('y-x').play();

            }
        }else {
            window.map_mp3_8=1;

        }

    }
    if (pageTop >= 10114 && pageTop < 10368) {
        var scale_2 = (pageTop - 10114) * 0.004;

        $(".map-18").get(0).style.webkitTransform = "scale(" + scale_2 + ")";
    } else {

        if (pageTop > 10368) {
            $(".map-18").get(0).style.webkitTransform = "scale(" + 1 + ")";

        }
    }
    if (pageTop >= 10643 && pageTop < 11113) {

        var count_18;
        if (parseInt((Math.min(((pageTop - 10643) * 1.1)))) >= 455) {

            count_18 = 185
        } else {
            count_18 = parseInt(640 - Math.min(((pageTop - 10643) * 1.1)))

        }
        $('.map-19').animate({
            left: count_18
        }, 0);

    } else {
        if (pageTop > 11113) {

            $('.map-19').animate({
                left: 185
            }, 0);
        }
    }


    if (pageTop >= 11426 && pageTop < 11603) {
        $(".map-20").get(0).style.opacity = (pageTop - 11426) * 0.01;
    } else {

        if (pageTop > 11603) {
            $(".map-20").get(0).style.opacity = 1
        }


    }
    if (pageTop >= 11712 && pageTop < 11813) {

        $(".map-21").get(0).style.opacity = (pageTop - 11712) * 0.01;
    } else {

        if (pageTop > 11813) {

            $(".map-21").get(0).style.opacity = 1
        }
    }
}
window.wx && wx.ready(function () {
    document.getElementById('b-j').play();
    // $('#y-x').attr('src','Public/static/audio/7.mp3');
    document.getElementById('y-x').play();
    document.getElementById('y-x').pause();
    var base = location.origin;
    var wxFriendData = {
        'link': base,
        'imgUrl': base + '/Public/static/images/share.jpg',
        // 内容
        'desc': '坐上这架时光机，带你重返【童年星球】。',
        // 标题
        'title': '一架终点是童年站的时光机，正在向你驶来...',
        trigger: function () {
        },
        success: function () {
        }
    };
    var wxTimelineData = {
        'link': base,
        'imgUrl': base + '/Public/static/images/share.jpg',
        'title': '一架终点是童年站的时光机，正在向你驶来...',
        trigger: function () {


        },
        success: function () {

        }
    };
    wx.onMenuShareAppMessage(wxFriendData);
    wx.onMenuShareTimeline(wxTimelineData);
});
