sequence实现一个图片轮换切换自然过渡效果代码

代码语言:html

所属分类:幻灯片

代码描述:sequence实现一个图片轮换切换自然过渡效果代码

代码标签: 图片 轮换 切换 自然 过渡 效果

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

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

<head>

  <meta charset="UTF-8">
  

  
  
  
  
<style>
/*
 * Styles: Body, HTML, and container
 * 1: Make the application fullscreen
 * 2: Basic reset styles
 */
body,
html,
.seq {

  /* #1 */
  width: 100%;
  height: 100%;

  /* #2 */
  margin: 0;
  padding: 0;
}

/*
 * Styles: Container
 * 1: Canvas, steps, and content should be positioned relative to the container
 * 2: Hide anything that goes beyond the boundaries of the Sequence container
 * 3: Some basic styles
 * 4: Set the initial background color
 * 5: Make the background color transition when navigating between steps
 */
.seq {

  /* #1 */
  position: relative;

  /* #2 */
  overflow: hidden;

  /* #3 */
  font-family: sans-serif;
  color: white;
  text-align: center;

  /* #4 */
  background-color: #2A93BC;

  /* #5 */
  transition-duration: .5s;
  transition-property: background-color;
}

/*
 * Styles: Canvas and steps
 * 1: Make the width/height of the screen, canvas, and steps the same size as the Sequence element
 * 2: Reset the canvas and steps for better browser consistency
 */
.seq-canvas,
.seq-canvas > * {

  /* #1 */
  height: 100%;
  width: 100%;

  /* #2 */
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * Styles: steps
 * 1: Position steps all in the same place
 * 2: Add whitespace around each step
 * 3: Make space for the pagination
 */
.seq-canvas > * {
  /* #1 */
  position: absolute;

  /* #2 */
  padding: 32px;
  box-sizing: border-box;

  /* #3 */
  height: auto;
  top: 0;
  bottom: 80px;
}

.seq-step1 {
  background-color: #2A93BC;
}

.seq-step2 {
  background-color: #6BC85E;
}

.seq-step3 {
  background-color: #45367E;
}

.feature {
  width: 70%;
  max-width: 100%;
  height: auto;
}

@media only screen and (min-width: 460px) and (min-height: 520px) {
  .feature {
    width: 100%;
  }
}


/* Ghost element */
.valign:before {
  content: "";
  height: 100%;
}

/* Vertically align the ghost and desired elements */
.valign:before,
.valign > .vcenter {
  display: inline-block;
  vertical-align: middle;
}

/* Remove 4px gap to allow consistent valign */
.valign {
  font-size: 0;
}

/* Reset font-size on valigned elements */
.valign > .vcenter {
  font-size: 16px;
}

/*
 * 1: Reset
 * 2: Titles should start as transparent
 * 3: When a change in opacity occurs, transition over .5s
 */
.title {
  /* #1 */
  margin: 0;

  /* #2 */
  opacity: 0;
  transform: translateX(50px) translateZ(0);

  /* #3 */
  transition-duration: .5s;
  transition-property: opacity, transform;
}

/*
 * When a step is active, fade in to opaque and slide to the center
 */
.seq-in .title {
  opacity: 1;
  transform: translateX(0) translateZ(0);
}

/*
 * When a step becomes inactive, fade out and slide to the left
 */
.seq-out .title {
  opacity: 0;
  transform: translateX(-50px) translateZ(0);
}

/*
 * Scale an image to 0 (so it can't be seen) when in its start position
 */
.feature {
  transform: translateZ(0) scale(0);
  transition-duration: .5s;
  transition-property: transform, opacity;
}

/*
 * When a step is active, make the image scale in
 */
.seq-in .feature {
  transform: translateZ(0) scale(1);
}
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0