css+js实现卡片式左右切换幻灯片头部效果代码

代码语言:html

所属分类:幻灯片

代码描述:css+js实现卡片式左右切换幻灯片头部效果代码

代码标签: 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 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0