js+css实现全屏横向和竖向文字幻灯片滚动效果代码

代码语言:html

所属分类:幻灯片

代码描述:js+css实现全屏横向和竖向文字幻灯片滚动效果代码,支持键盘上下左右键进行控制。

代码标签: js css 全屏 横向 竖向 文字 幻灯片 滚动

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

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

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

  
  
  
<style>
body {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif;
  font-weight: normal;
  height: 100dvh;
  margin: 0;
  scrollbar-color: #0003 #0001;
  scrollbar-width: thin;
  width: 100vw;
}

.ui-scroll-grid {
  container-type: inline-size;
  height: 100dvh;
  list-style-type: none;
  margin: 0;
  overflow: clip auto;
  padding: 0;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  width: 100vw;

  ol {
    display: flex;
    list-style-type: none;
    overflow: auto clip;
    padding: 0;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
  }

  li {
    background: var(--bg);
    box-sizing: border-box;
    color: #FFFD;
    display: grid;
    flex: 0 0 calc(100vw - 1rem);
    font-size: 7.5cqi;
    height: 100dvh;
    padding-inline: 1rem;
    place-content: center;
    scroll-snap-align: start;
    text-align: center;
    text-wrap: balance;
  }

  & > li {
    &:nth-of-type(1) { --bg: #123; }
    &:nth-of-type(2) { --bg: #187; }
    &:nth-of-type(3) { --bg: #C90; }
    &:nth-of-type(4) { --bg: #D32; }
    &:nth-of-type(5) { --bg: #594; }
  }
}

.ui-scroll-grid-nav {
  bottom: 2rem;
  display: grid;
  gap: .25rem;
  grid-template-columns: repeat(5, 1fr);
  position: fixed;
  right: 2rem;

  a {
    aspect-ratio: 1;
    background-color: #FFFD;
    bo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0