博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery 向上(顶部),向下(底部)滑动
阅读量:4198 次
发布时间:2019-05-26

本文共 1803 字,大约阅读时间需要 6 分钟。

js代码部分:

window.onload = function(){	var oTop = document.getElementById("goTop");	var screenw = document.documentElement.clientWidth || document.body.clientWidth;	var screenh = document.documentElement.clientHeight || document.body.clientHeight;	var screenb = $(document).height(); 	var oBottom = document.getElementById("goBottom");	window.onscroll = function(){		var scrolltop = document.documentElement.scrollTop || document.body.scrollTop;		if(scrolltop-10 > 0){			oTop.style.display = "block";		}else{			oTop.style.display = "none";		}		if(screenb - screenh - scrolltop < 15){			oBottom.style.display = "none";		}else{			oBottom.style.display = "block";		}			}	oTop.onclick = function(){		//document.documentElement.scrollTop = document.body.scrollTop =0;		$("html,body").animate({scrollTop:0},"slow");		}		oBottom.onclick = function(){		//document.documentElement.scrollTop = document.body.scrollTop =0;		$("html,body").animate({ scrollTop:screenb  },"slow");			}}

2 html代码部分:

3css部分:

.footer_fixed{position:fixed;right:22px;bottom:22px;z-index:99}.go_top {    height: 42px;}.go_top :hover{	background-position: -45px 0px;}#goTop , .cus_survey, .go_bottom{  background: url("../images/footer_fixed.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);    display: block;    height: 40px;    margin: 0 0 -1px;    text-indent: -999em;    width: 43px;}.cus_survey {    background-position: 0 -41px;}.cus_survey:hover{	background-position: -45px -41px;}.go_bottom:hover{	background-position: -45px -119px;}.footer_fixed .ph {    display: block;    height: 42px;}.go_bottom {    background-position: 0 -119px;    height: 43px;}

4 背景图片:

http://img.dxcdn.com/combo/global/v5.0.2/img/footer_fixed.png

转载地址:http://xjdli.baihongyu.com/

你可能感兴趣的文章
自动化测试框架之控制界面的关键
查看>>
自动化测试框架指南
查看>>
利用 STAF 实现程序更新包的自动部署测试
查看>>
软件安全性测试转载自小龙虾博客
查看>>
周末参加“北京干部管理职业技术学院”关于高职课程改革的专家讨论会
查看>>
软件测试框架介绍
查看>>
软件自动化测试框架的发展
查看>>
实现haproxy+LNMT负载均衡架构
查看>>
TensorFlow和keras的前世今生以及keras和tf.keras的对比
查看>>
Keras(一)分类模型实战
查看>>
Keras(二)回归模型实战
查看>>
Keras(三)实现深度神经网络
查看>>
sigmoid函数求导、求极值(史上最详细)
查看>>
Keras(四)实现批标准化、激活函数、dropout
查看>>
Keras(五)wide_deep模型
查看>>
Keras(六)keras模型封装转化为sklearn模型、使用超参数搜索
查看>>
排坑:TypeError: handle_get_file_code() got an unexpected keyword argument ‘save_all‘
查看>>
C++ explict
查看>>
const
查看>>
new & delete
查看>>