1 Star 0 Fork 83

丶Leaves°/前端页面效果合集

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
滑动图片 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
木兰君 提交于 2020-08-03 20:26 . add 滑动图片.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin: 0;
padding: 0;
}
.slider {
width: 100%;
height: 100vh;
display: flex;
background: url('./img/landscape-5009868__340.webp') no-repeat;
background-position: 0 center;
background-size: 100vw;
position: relative;
}
.slider input {
-webkit-appearance: none;
width: 100%;
background: none;
z-index: 10;
}
.slider input::-webkit-slider-thumb {
-webkit-appearance: none;
width: 10px;
height: 100vh;
background-color: #111;
cursor: pointer;
}
.original-image {
position: absolute;
left: 0;
width: 20%;
height: 100vh;
background: url('./img/landscape-5072202__340.webp') no-repeat;
background-position: 0 center;
background-size: 100vw;
}
</style>
</head>
<body>
<div class="slider">
<div class="original-image"></div>
<input type="range" value="20" max="100">
</div>
<script>
document.querySelector('.slider input').addEventListener('input', function(){
document.querySelector('.original-image').style.width = this.value + '%'
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/QM_C/front_page_effect_collection.git
git@gitee.com:QM_C/front_page_effect_collection.git
QM_C
front_page_effect_collection
前端页面效果合集
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385