移动端双击导航栏,回到顶部var i=0;

    $(‘.shuangjidaohang’).on(‘click’, function () {

        i++;

        setTimeout(function () {

            i = 0;

        }, 500);

        if (i > 1) {

            if($(window.frames[“homeFrame”].document).find(‘.swiper-container’).length != 0){

                var childWindow = $(“#homeFrame”)[0].contentWindow

                childWindow.swiperPull.mySwiper.slideTo(0,500)

                return;

            }

            if($(window.frames[“homeFrame”].document).scrollTop()>0){

                var interval = setInterval(function(){

                    if($(window.frames[“homeFrame”].document).scrollTop()<=0){

                        clearInterval(interval);

                    }

                    var height =  $(window.frames[“homeFrame”].document).scrollTop()

                    $(window.frames[“homeFrame”].document).scrollTop( $(window.frames[“homeFrame”].document).scrollTop()-500)

                },100)

            }

            i = 0;

        }

    });

猜你喜欢

转载自blog.csdn.net/qq_34873894/article/details/83187083