页面滚动视觉效果实现
来源:互联网 发布:nginx不支持pathinfo 编辑:程序博客网 时间:2024/06/06 03:57
<div style="width:100%;position:relative;height: 800px;background-color: #ff5684;">
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
</div>
<div style="width:100%;position:relative;height: 800px;background-color: #B2DBA1;margin-top: 700px;">
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
</div>
<div style="width:100%;position:relative;height: 800px;background-color: skyblue;margin-top: 700px;">
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
<h1>感谢观看</h1>
</div>
</body>
<script type="text/javascript">
//检查浏览器 是否支持
function scroll() {
//判断当前的浏览器是否是IE9+ 或者其他浏览器
if (window.pageYOffset != null) {
return {
left: window.pageXOffset,
top: window.pageYOffset
};
}
//检测是否是怪异模式浏览器,就是没有声明<!DOCTYPE html>
else if(document.compatMode == "CSS1Compat"){
//正常模式
return {
left: document.documentElement.scrollLeft,
top: document.documentElement.scrollTop
};
}
//怪异浏览器
return {
left:document.body.scrollLeft,
top:document.body.scrollTop
};
}
//核心滚动代码
window.onscroll = function () {
//backgroundAttachment 属性设置背景图像是否固定或者随着页面的其余部分滚动。
var dis = scroll().top;
if(dis <= 1500){
document.body.style.backgroundImage = "url(img/IMG_3441.JPG)";
document.body.style.backgroundAttachment = "fixed";
}
else if(dis > 1500&& dis<3000){
document.body.style.backgroundImage = "url(img/IMG_3443.JPG)";
document.body.style.backgroundAttachment = "fixed";
}else{
document.body.style.backgroundImage = "url(img/IMG_3442.JPG)";
document.body.style.backgroundAttachment = "fixed";
}
}
</script>
- 页面滚动视觉效果实现
- 实现页面滚动条
- 实现页面局部内容滚动
- html页面实现滚动字幕
- jQuery实现页面平滑滚动
- 页面实现图片滚动效果
- 页面滚动条的实现
- android屏幕页面实现滚动,页面跳转
- JQuery 拖动页面实现页面滚动
- 交叉滚动(多层卷轴)带来的视觉效果
- j2me实现动态绘制滚动条,页面滚动…
- jquery实现滚动条随着页面高度增加向下滚动
- javascript实现页面图片不间断连续滚动
- Javascript实现神奇的页面滚动控制
- 鼠标滑轮滚动实现页面翻滚
- Marquee实现整个页面的滚动
- 页面滚动时,异步加载的实现
- IOS页面滚动指示器实现实例
- github远程仓库
- Fibonacci的前四位
- 20170610 printf占位符
- Android UI和切图
- 平衡二叉树(AVL)模板
- 页面滚动视觉效果实现
- Java for Web学习笔记(五九):Controller替代Servlet(1)请求匹配
- Give it five minutes
- 各种OJ刷题记录5.31-6.8
- 遍历map数组
- 读白刃underscore疑惑分析--underscore源码学习三
- CRC校验-arp脚本
- Nginx的个人理解
- 几种跨域处理方式