Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
js 刷新页面后恢复到原先滚动条的位置 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


用的 jQuery ,源码来自:(206条消息) js:返回到页面时滚动到上次浏览位置_chu782729918的博客-CSDN博客


经我测试发现,火狐没问题,但是 edge 上面貌似……不太行。


代码:

// 滚动时保存页面位置
$(window).scroll(function(){
    if($(document).scrollTop()!=0){
        sessionStorage.setItem("offsetTop", $(window).scrollTop());
    }
});

// 页面加载时,回到上次保存位置
$(document).ready(function(){
    var offset = sessionStorage.getItem("offsetTop");
    $(document).scrollTop(offset);
});




返回首页


Copyright (C) 2018-2024 huidong