时间:2021-07-01 10:21:17 帮助过:19人阅读
返回顶部
Chrome and Safari always use document.body.scrollTop, while IE and Firefox use document.body.scrollTop for quirks mode and document.documentElement.scrollTop for standard mode.
Your best bet may be something like:
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
var scrolLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
Chrome and Safari always use document.body.scrollTop, while IE and Firefox use document.body.scrollTop for quirks mode and document.documentElement.scrollTop for standard mode.
Your best bet may be……
我这个怎么修改呢。。
backTop = function (btnId) { var btn = document.getElementById(btnId); var d1 = document.documentElement; var d2 = document.body; var d = d1.scrollTop + d2.scrollTop; window.onscroll = set; btn.onclick = function () { btn.style.display = "none"; window.onscroll = null; this.timer = setInterval(function () { d -= Math.ceil(d* 0.1); if (d == 0) clearInterval(btn.timer, window.onscroll = set); }, 10); }; function set() { btn.style.display = d ? 'block' : "none" } }; backTop('gotopbtn');
JScript code
backTop = function (btnId) {
var btn = document.getElementById(btnId);
var d1 = document.documentElement;
var d2 = document.body;
……
不行吖。。直接隐藏了 不显示了
引用 4 楼 的回复:
引用 3 楼 的回复:
JScript code
backTop = function (btnId) {
var btn = document.getElementById(btnId);
var d1 = document.documentElement;
var d2 = document.body;
……
不行吖。。直接隐藏了 ……
不返回首页了。