css+js实现卡片式左右切换幻灯片头部效果代码
代码语言:html
所属分类:幻灯片
代码描述:css+js实现卡片式左右切换幻灯片头部效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
/* RESET CSS */
* {margin: 0; padding: 0;}
/* CAROUSEL CSS */
.carousel {position: relative;}
.carousel::after {
content: "";
position: absolute;
left: 0;
top: 0;
box-shadow: inset 0px 0px 120px 30px rgba(0,0,0,0.35);
width: 100%;
height: 100%;
pointer-events: none;
}
.carousel ul {
overflow: auto;
display: flex;
height: 500px;
max-height: 500px;
scroll-snap-type: x mandatory;
scroll-snap-points-y: repeat(100%);
scroll-snap-align: left;
scroll-behavior: smooth;
background: gray;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.carousel ul::-webkit-scrollbar {display: none; /* Hide scrollbar for Chrome, Safari and Opera */}
.carousel ul li {
width: 100%;
min-width: 100%;
list-style: none;
scroll-snap-align: start;
display: flex;
justify-content: center;
align-items: center;
color: black;
font-weight: bold;
font-size: 25px;
text-align: center;
margin-right: calc(-100% + 300px);
transition: transform 0.2s linear;
opacity: 0.3;
line-height: 1;
position: relative;
bottom: 15px;
}
.carousel ul li.selected {opacity: 1; z-index: 9;}
.carousel ul li.selected > div {transform: scale(1.6);}
.carousel ul li > div {
z-index: 9;
margin: 0 auto;
max-width: 170px;
background: white;
transition: all 0.2s linear;
transform: scale(0.95);
padding: 20px 15px;
}
.carousel ul li > div > div {
background: url(//repo.bfw.wiki/bfwrepo/image/6374680372999.png) center center / cover no-repeat;
height: 110px;
margin-bottom: 15px;
margin: -20px -15px 15px;
}
.carousel ul li div a {color: white; display: inline-block; background: white; color: white; padding: 8px 15px; font-size: 13px; text-decoration: none; border-radius: 4px; margin-top: 17px; background: black;}
.carousel ol {position: absolute; bottom: 15px; display: flex; justify-content: center; left: 50%; transform: translateX(-50%); z-index: 9;}
.carousel ol li {list-style: none; padding: 0 5px;}
.carousel ol li a {display: block; height: 10px; width: 10px; border: 2px solid white; background: transparent; border-radius: 100%;}
.carousel ol li.sele.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0