原生js实现全屏幻灯片效果

代码语言:html

所属分类:幻灯片

代码描述:原生js实现全屏幻灯片效果,无需依赖其他js框架和库

代码标签: 全屏 幻灯片 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
/* RESET RULES & HELPER CLASSES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: transparent;
  border: none;
  outline: none;
}

body {
  font: 20px/28px sans-serif;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

.cover {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  height: 100vh;
}


/* SLIDESHOW
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.slideshow {
  cursor: none;
}

.slideshow .slides {
  display: grid;
}

.slideshow .slide {
  grid-column: 1;
  grid-row: 1;
  opacity: 0;
  -webkit-transition: opacity 0.4s;
  transition: opacity 0.4s;
}

.slideshow .slide.is-active {
  opacity: 1;
}

.slideshow .arrows {
  position: absolute;
  top: 0;
  left: 0;
  display: -webkit-box;
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slideshow .arrows .arrow {
  position: relative;
  width: 50%;
  cursor: inherit;
  visibility: hidden;
  overflow: inherit;
}

.slideshow .arrows .is-visible {
  visibility: visible;
}

.slideshow .arrows span {
  position: absolute.........完整代码请登录后点击上方下载按钮下载查看

网友评论0