最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
h5页面背景图很长要有滚动条滑动效果实现代码
时间:2022-06-25 17:52:45 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下h5页面背景图很长要有滚动条滑动效果实现代码,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
背景图铺满页面,要求有滚动条可以滑动,思路是用js获取背景图片的高,在获取当前窗口的高,两者比较,当窗口的高小于背景图片的高,把窗口的高设置成背景颜色的高。反之就是窗口的高。
长背景图测试/title>
这是网上的代码。
改动了下
body{ background: -webkit-linear-gradient(to bottom , #699eef, #8e92ef); background: -o-linear-gradient(to bottom , #699eef, #8e92ef); background: -moz-linear-gradient(to bottom , #699eef, #8e92ef); background: linear-gradient(to bottom , #699eef, #8e92ef); } .app { width: 100%; /* */ min-height: 120vh; /* position: fixed; */ /* top: 0; */ /* left: 0; */ background: url('../../images/bg.jpg') no-repeat; background-size: 100% auto; }
给body加了个跟图片颜色一样的背景色
相关文章
- 《夜族崛起》铁匠西里尔位置一览 05-17
- 《寓言之地》1.02更新内容一览 05-17
- 《辐射4》steam好评率介绍 05-17
- 《夜族崛起》技能强化珠宝掉落说明 05-17
- 《辐射4》主机控制台介绍 05-17
- 《星露谷物语》海草和绿藻获取方法 05-17