返回上一頁歷史位置

引入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);
    })
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章