码迷,mamicode.com
首页 > 移动开发 > 详细

移动端列表进入详情后返回列表回到原位置

时间:2019-07-11 14:06:21      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:function   style   path   code   nim   class   end   win   ref   

 // 返回上次浏览位置
    $(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);
    });
    // 返回上次浏览位置 end

 

移动端列表进入详情后返回列表回到原位置

标签:function   style   path   code   nim   class   end   win   ref   

原文地址:https://www.cnblogs.com/sdsd123/p/11169511.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!