gsap+svg实现问题答案faq折叠手风琴面板效果代码

代码语言:html

所属分类:其他

代码描述:gsap+svg实现问题答案faq折叠手风琴面板效果代码

代码标签: gsap svg 问题 答案 faq 折叠 手风琴 面板

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

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

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

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@200;300;400;500;600&display=swap");
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-smoothing: antialiased;
  font-family: "Inter Tight";
  -webkit-font-smoothing: antialiased;
}

:root {
  --accordion-menu-fs: 1.8rem;
  --accordion-icon-width: 24px;
  --accordion-icon-weight: 2px;
}

body {
  height: 100%;
}

.accordion {
  width: 100%;
  margin: 0;
}

.accordion-group:is(.active) .accordion-menu:before {
  rotate: 0deg;
}
.accordion-group:nth-child(1) {
  background: #222;
}
.accordion-group:nth-child(2) {
  background: #333;
}
.accordion-group:nth-child(3) {
  background: #444;
}
.accordion-group:nth-child(4) {
  background: #555;
}
.accordion-group:nth-child(5) {
  background: #666;
}
.accordion-group:nth-child(6) {
  background: #777;
}
.accordion-group:nth-child(7) {
  background: #888;
}

.accordion-menu {
  font-size: var(--accordion-menu-fs);
  color: white;
  padding: 5vw;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
.accordion-menu:before {
  height: var(--accordion-icon-weight);
  position: absolute;
  right: 5vw;
  background: white;
  content: "";
  transition: all 0.3s ease;
  width: var(--accordion-icon-width);
  rotate: -90deg;
}
.accordion-menu:after {
  height: var(--accordion-icon-weight);
  position: absolute;
  right: 5vw;
  background: white;
  content: "";
  transition: all 0.3s ease;
  width: var(--accordion-icon-width);
}

.accordion-content {
  height: 0;
  overflow: hidden;
  font-size: 1rem;
}

.accordion-content.expanded {
  height: 0;
  overflow: hidden;
}

p {
  padding-inline: 5vw;
  padding-block-end: 5vw;
  color: white;
  font-size: 1.5rem;
  max-width: 60ch;
}

.active .accordion-content {
  height: auto;
}

footer {
  height: 50vh;
  width: 100%;
  padding: 5vw;
  background: black;
  color: white;
  z-index: -10;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 10vh;
  align-items: center;
  transform: translateY(-100%);
  position: relative;
}
</style>


  
</head>

  <body>
  
  <div id="wrapper">  
  <div id="content">

  <div class="accordion">

    <div class="accordion-group">
      <div class="accordion-menu">
        Question 1
      </div>
      <div class="accordion-content">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
      </div>
    </div>

    <div class="accordion-group">
      <div class="accordion-menu">
        Question 2
      </div>
      <div class="accordion-content">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
      </div>
    </div>

    <div class="accordion-group">
      <div class="accordion-menu">
        Question 3
      </div>
      <div class="accordion-content">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit .........完整代码请登录后点击上方下载按钮下载查看

网友评论0