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; border-radius: 50%; display: block; width: .5rem; &.active { background-color: #0EF; } } } </style> </head> <body translate="no"> <ol class="ui-scroll-grid"> <li> <ol> <li id="r1-c1">You can enter Nowhere from Anywhere.</li> <li id="r1-c2">I came from the North.</li> <li id="r1-c3">I am now here.<br>In Nowhere.</li> <li id="r1-c4">The map, a sheet of paper, with a single sentence.</li> <li id="r1-c5">“The only way out is in”</li> </ol> </li> <li> <ol> <li id="r2-c1">My canister if half full.<br>Or half empty?</li> <li id="r2-c2">The path can lead to Anywhere.<br>Or Everywhere.</li> <li id="r2-c3">Just keep walking.<br>Aimlessly.<br>Or determined.</li> <li id="r2-c4">Did I just spot Yin and Yang?</li> <li id="r2-c5">Nothing is permanent.</li> </ol> </li> <li> <ol> <li id="r3-c1">You can enter Nowhere from Everywhere.</li> <li id="r3-c2">I came from the West.</li> <li id="r3-c3">I am now in the Middle of Nowhere.</li> <li id="r3-c4">I came from the East.</li> <li id="r3-c5">You can enter Nowhere from Everywhere.</li> </ol> </li> <li> <ol> <li id="r4-c1">Nothing is permanent.</li> <li id="r4-c2">Did I just spot Yang and Yin?</li> <li id="r4-c3">Just keep walking.<br>Determined.<br>Or aimlessly.</li> <li id="r4-c4">The path can lead to Everywhere.<br>Or Anywhere.</li> <li id="r4-c5">My canister if half empty.<br>Or half full?</li> </ol> </li> <li> <ol> <li id="r5-c1">“The only way out is in”</li> <li id="r5-c2">The map, a sheet of paper, with a single sentence.</li> <li id="r5-c3">I am now here.<br>In Nowhere.</li> <li id="r5-c4">I came from the South</li> <li id="r5-c5">You can enter Nowhere from Anywhere.</li> </ol> </li> </ol> <nav class="ui-scroll-grid-nav"> <a href="#r1-c1" title="Row 1, Cell 1"></a> <a href="#r1-c2" title="Row 1, Cell 2"></a> <a href="#r1-c3" title="Row 1, Cell 3"></a> <a href="#r1-c4" title="Row 1, Cell 4">.........完整代码请登录后点击上方下载按钮下载查看
网友评论0