js实现图文幻灯片切换效果代码

代码语言:html

所属分类:幻灯片

代码描述:js实现图文幻灯片切换效果代码

代码标签: js 图文 幻灯片 切换

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
.articles {
  display: grid;
  padding: 1.2em 1.6em;
  color: white;
  border-radius: 1em;
  background-color: white;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
}
.articles nav {
  grid-column: 1/-1;
  display: flex;
  gap: 1ch;
  justify-content: center;
  grid-row: 1;
}
.articles nav button {
  background: grey;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  border-radius: 0.5ch;
}
.articles nav button:hover {
  background: black;
}
.articles article {
  display: contents;
}
.articles article:nth-of-type(1) picture {
  background-color: red;
}
.articles article:nth-of-type(1) picture::after {
  content: "1";
}
.articles article:nth-of-type(2) picture {
  background-color: blue;
}
.articles article:nth-of-type(2) picture::after {
  content: "2";
}
.articles article:nth-of-type(3) picture {
  background-color: green;
}
.articles article:nth-of-type(3) picture::after {
  content: "3";
}
.articles article[aria-selected] .content {
  opacity: 1;
  transition-delay: 0.6s, 0s;
  grid-template-rows: 1fr;
  z-index: 1;
}
.articles article[aria-selected] picture {
  transition-delay: 0s;
  -webkit-clip-path: circle(50% at 50% 50%);
          clip-path: circle(50% at 50% 50%);
  z-index: 1;
}
.articles article[aria-selected] picture img {
  scale: 1;
}
.articles .content {
  grid-row: 2;
  grid-column: 2;
  display: grid;
  color: black;
  max-width: 360px;
  opacity: 0;
  grid-template-rows: 0fr;
  transition: opacity 0.6s, grid-template-rows 0.6s 0.6s ease-in;
  transition: opacity 0.6s, grid-template-rows 0.6s 0.6s ease-in, -ms-grid-rows 0.6s 0.6s ease-in;
}
.articles .content p {
  overflow: hidden;
}
.articles picture {
  grid-row: 2;
  grid-column: 1;
  background-color: white;
  border-radius: 50%;
  position: relative;
  font-size: 10rem;
  aspect-ratio: 1;
  color: white;
  transition: -webki.........完整代码请登录后点击上方下载按钮下载查看

网友评论0