css实现横向滚动图片相册代码

代码语言:html

所属分类:画廊相册

代码描述:css实现横向滚动图片相册代码下拉选择事件回调示例代码

代码标签: css 横向 滚动 图片 相册 代码

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

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

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

  
  
  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Staatliches&display=swap');

body {
  display: grid;
  place-items: center;
  width: 100vw;
  width: 100svw;
  height: 100vh;
  height: 100svh;
  scroll-behavior: smooth;
  padding: 0;
  margin: 0;
}

* {
  margin: 0;
}

.title {
  position: absolute;
  top: 1rem;
  color: white;
  text-align: center;
  font-family: "Staatliches";
}

.container {
  scroll-behavior: smooth;
  scroll-snap-type: both mandatory;
  
  & > .content {
    scroll-snap-align: start;
  }
  
  height: 100svw;
  position: absolute;
  overflow-x: auto;
  transform: rotateZ(90deg) scaleY(-100%);
  display: flex;
  flex-direction: column;
  gap: 20svw;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), linear-gradient(160deg, #1CB5E0 0%, #000851 100%);
}

.container > .content {
  width: 70svw;
  display: grid;
  place-items: center;
  
  transform: rotateZ(-90deg) scaleX(-100%) scaleY(1) translateX(100%);
}

.container .content:last-of-type {
  margin-bottom: 250rem;
}

img {
  width: 65%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 2rem;
  
  @supports (animation-timeline: view()) {
    animation: animate-in ease-in forwards;
    animation-timeline: view();
    animation-range: entry -0% cover 170%;
  }
}

@keyframes animate-in {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  60%,
  70% {
    opacity: 1; 
    transform: scale(1) translateX(10%);
  }
  100% {
    opacity: 0;    
    transform: scale(0);    
  }
}

@keyframes side-left {
  0% {
    opacity: 0;
    transform: rotateZ(-90deg) scaleX(0) translateX(100rem);
    filter: drop-shadow(0 0 0 rgba(0,0,0,0.15))
  }
  50% {
    opacity: 1; 
    transform: rotateZ(-90deg) scaleX(-100%) scaleY(1) translateX(0);
    filter: drop-shadow(1rem 2rem 20px rgba(0,0,0,0.15))
  }
  100% {
    opacity: 0;    
    transform: rotateZ(-90deg) scaleY(0) translateX(-100rem);
    filter: drop-shadow(0 0 0 rgba(0,0,0,0.15))
  }
}
</style>


  
  
</head>

<body translate="no">
  <.........完整代码请登录后点击上方下载按钮下载查看

网友评论0