返回顶部

    <script>
        $(window).scroll(function(e){
            console.log($(window).scrollTop());
            if ($(window).scrollTop() >100) {
                $('.toTop').fadeIn(1000);
            } else {
                $('.toTop').fadeOut(1000);
            }
        })
        $('.toTop').click(function(){
            $('body,html').animate({scrollTop:0},1000);
        })
    </script>

 

posted @ 2017-11-13 15:24  赛赛大人  阅读(113)  评论(0编辑  收藏  举报