js+css实现立体层叠卷轴幻灯片代码

代码语言:html

所属分类:幻灯片

代码描述:js+css实现立体层叠卷轴幻灯片代码,可拖拽或滚动鼠标滚动切换。

代码标签: js css 立体 层叠 卷轴 幻灯片 代码

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

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

<head>
  <meta charset="UTF-8">
  
  
<style>
@import url(https://fonts.googleapis.com/css2?family=Limelight&display=swap);

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: #fff0;
    user-select: none
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 30% 20%, #0a0f1c, #020408);
}

.wrap {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    background: radial-gradient(circle at 30% 20%, #0a0f1c, #020408);
    position: relative
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
    flex-direction: column;
    gap: 20px
}

.loader.hidden {
    opacity: 0;
    pointer-events: none
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgb(255 255 255 / .1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.loader-text {
    color: #fff;
    font-size: 14px;
    letter-spacing: 1px
}

.viewport {
    width: 100%;
    height: 60vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    cursor: grab;
    touch-action: none;
    opacity: 0;
    transition: opacity 0.5s ease
}

.viewport.visible {
    opacity: 1
}

.viewport.dragging {
    cursor: grabbing
}

.track {
    position: absolute;
    top: 50%;
    left: 0;
    height: 100%;
    transform: translateY(-50%);
    transform-style: preserve-3d
}

.title {
    font-family: "Limelight", sans-serif;
    font-weight: 400;
    position: fixed;
    top: 10px;
    right: 20px;
    color: rgb(255 200 120 / .85);
    font-size: clamp(3em, 15vw, 10em);
    z-index: 10
}

.card {
    height: 60vh;
    aspect-ratio: 16 / 9;
    margin-right: 5vw;
    overflow: hidden;
    position: absolute;
    top: 0;
    background: #1a1a1a;
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgb(0 0 0 / .3);
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    opacity: 0
}

.card-inner {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
    pointer-events: none;
    background: #1a1a1a
}

.card-inner img {
    width: 120%;
    height: 120%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    position: relative;
    left: -10%;
    top: -10%;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease
}

.card-inner img.loaded {
    opacity: 1
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgb(0 0 0 / .97);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(20px)
}

.fullscreen-overlay.active {
    display: flex;
    opacity: 1
}

.fullscreen-container {
    display: flex;
    gap: 40px;
    max-width: 90vw;
    max-height: 85vh;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / .6);
    border-radius: 20px;
    padding: 20px;
    transition: all 0.3s ease
}

.fullscreen-container:fullscreen {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 0;
    background: #000
}

.fullscreen-container:-webkit-full-screen {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 0;
    background: #000
}

.fullscreen-container:fullscreen .fullscreen-image {
    max-height: 100vh;
    max-width: 100vw
}

.fullscreen-container:fullscreen .fullscreen-info {
    display: none
}

.fullscreen-container:fullscreen .fullscreen-image-wrapper {
    flex: 1
}

.fullscreen-image-wrapper {
    flex: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position.........完整代码请登录后点击上方下载按钮下载查看

网友评论0