页面跳转保留滚动条位置
主要实现逻辑是页面跳转前记录下滚动条坐标到cookies,跳转后回复坐标
.onbeforeunload = () {
;
(.pageYOffset != ) {
= .pageYOffset;
}
(.compatMode != && .compatMode != ) {
= .documentElement.scrollTop;
}
(.body != ) {
= .body.scrollTop;
}
.cookie = + ; }
.onload = () {
(.cookie.() != ) {
= .cookie.(); .documentElement.scrollTop = ([]);
.body.scrollTop = ([]);
}
}
仅有一条评论
添加新评论
- 上一篇: php空格变加号
- 下一篇: mysql或MariaDB提示too many connections
很不错