div+css原生实现图文堆叠堆积幻灯片点击切换效果代码

代码语言:html

所属分类:幻灯片

代码描述:div+css原生实现图文堆叠堆积幻灯片点击切换效果代码

代码标签: div css 原生 图文 堆叠 堆积 幻灯片 点击 切换

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

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

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


<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
  
  
  
<style>
/* register these two so they can be transitioned */
/* index of previous top item during the animation
 * after another has been selected */
@property --p {
  syntax: "<number>";
  initial-value: 0;
  inherits: true;
}
/* animated index of top item from previous to current */
@property --v {
  syntax: "<number>";
  initial-value: 0;
  inherits: true;
}
* {
  margin: 0;
}

/* poor man's reset */
/* grid everything! */
html, body, section, article, button {
  display: grid;
}

/* full viewport height container for stack section */
html {
  min-height: 100%;
}

body {
  background: #070410;
}

section {
  /* set previous top item index to current top index
   * 0s duration delayed transition ensures switch happens 
   * after the switching top item transtion */
  --p: var(--k);
  /* set previous top item index to current top index
   * a transition ensures switch doesn't happen instantly */
  --v: var(--k);
  /* difference between current & previous top item indices
   * 0 if not during animation, 
   * 1 during ani.........完整代码请登录后点击上方下载按钮下载查看

网友评论0