有没有见过很多在页面的右下角有个【回到顶端】的悬浮东东,并且在开始时没有,一移动滚动条就出现,回到了顶端又消失的样子。
像:
控制的js代码如下:
function goTop(){
var _btn = document.getElementById("goTop");
if (document.documentElement && document.documentElement.scrollTop) {
var _con = document.documentElement;
} else if (document.body) {
var _con = document.body;
}
window.onscroll = set;
_btn.style.left = document.documentElement.scrollWidth/2 + 500 + "px";
_btn.onclick = function (){
_btn.style.display = "none";
window.onscroll = null;
this.timer = setInterval(function() {
_con.scrollTop -= Math.ceil(_con.scrollTop * 0.3);
if (_con.scrollTop == 0) clearInterval(_btn.timer, window.onscroll = set);
},10);
};
function set() {
_btn.style.display = _con.scrollTop ? 'block': "none";
}
};
document.write("<div id=\"goTop\" style=\"font-size:12px; width:20px; height:55px; background:#0950A2; color:#fff; line-height:14px; position:fixed; bottom:30px; display:none; cursor:pointer; text-align:center; padding:5px 0; z-index:1; _position:absolute; _top:expression(eval(document.compatMode && document.compatMode == \'CSS1Compat\') ? documentElement.scrollTop + (documentElement.clientHeight - this.clientHeight) - 30 : document.body.scrollTop + (document.body.clientHeight - this.clientHeight) - 30);\">返<br />回<br />顶<br />部</div>");
window.onscroll = goTop;
分享到:
相关推荐
像: 控制的js代码如下: 代码如下: function goTop(){ var _btn = document.getElementById(“goTop”); if (document.documentElement && document.documentElement.scrollTop) { var _con = document....
淘宝的ued一直相当不错,在他的产品内页,当浏览者浏览网页往下滚动网页会很人性化的出现回到顶部按钮。 此代码完全模仿这种效果利用jquery实现,淡进淡出效果等。关闭、打开 滚动动画效果,默认是关闭的,有需要...
Gotop卸载程序,把它放在Gotop的文件夹内双击即可开始卸载。
GoTop.exe
很好用的卸载恶意软件GoTop的工具,把它放在Gotop的文件夹内双击即可开始卸。
把引用的JS文件放在div标签下面 <div id="gotop">返回顶部 [removed][removed]
随着近几年来 JavaScript 的应用日渐广泛,... … JavaScript 代码: 代码如下: /** * 回到页面顶部 * @param acceleration 加速度 * @param time 时间间隔 (毫秒) **/ function goTop(acceleration, time) { acceleratio
淘宝首页的回到顶部按钮是这样的:下拉到一定距离后按钮才显示出来,鼠标放到按钮上时,按钮背景会变成灰色,并且图标变成了文字。点击按钮缓慢回到顶部 我们先分析下实现这样的效果需要添加哪些事件。鼠标移进移出...
gotop返回顶部悬挂猫,博客自用,资源来自网上
将网页滚动到顶部的更简单的方法。 goTOP adiciona umbotãono canto superior da tela que quando clicado so be a pagina para o topo.Facilitando nautilizaçãodepáginascomcondúdconteúdo。 支持语言:...
gotop
script type =" module " src =" sws-gotop.min.js " > </ script > 通过css自定义属性设置元素的样式等。 sws-gotop { --sws-gotop-size : 80 px ; --sws-gotop-right : 50 px ; --sws-gotop-...
开源项目-cjbassi-gotop.zip,gotop - A terminal based graphical activity monitor inspired by gtop and vtop and written in Go
语言:English 将网页滚动到顶部的更简单的方法。内容量。
一,使用view形式的回到顶部 HTML: <image src='../../img/button-top.png' class='goTop' hidden='{{!floorstatus}}' bindtap=goTop> CSS: /* 返回顶部 */ .goTop{ height: 80rpx; width: 80rpx; ...
gotop - 基于终端的图形活动监视器受到gtop和vtop的启发
快速启动GoTop Media 使用GoTop开发Magento✓自定义Magento开发✓我们建设Magento网站已有10多年的历史。 :right_arrow:联系我们 支持语言:English
语言:English 快速启动GoTop Media 使用GoTop开发Magento✓自定义Magento开发✓我们建设Magento网站已有10多年的历史。 :right_arrow:联系我们
存在gotop的维护叉。 另一个受和启发的基于终端的图形活动监视器,这次用 !编写! 安装 在Linux,FreeBSD和macOS上工作并经过测试。 Windows支持已计划。 OpenBSD需要注意一些事项。 资源 go get github....