返回上一页历史位置

引入jquery.cookie.js
下载链接:http://plugins.jquery.com/cookie/
 $(function () {
        var str = window.location.href;
        str = str.substring(str.lastIndexOf("/") + 1);
        if ($.cookie(str)) {

            $("html,body").animate({ scrollTop: $.cookie(str) }, 1000);
        }
        else {
        }
    })

    $(window).scroll(function () {
        var str = window.location.href;
        str = str.substring(str.lastIndexOf("/") + 1);
        var top = $(document).scrollTop();
        $.cookie(str, top, { path: '/' });
        return $.cookie(str);
    })

猜你喜欢

转载自blog.csdn.net/weixin_43292447/article/details/85092034
今日推荐