js+css实现简洁带进度轮播图效果代码
代码语言:html
所属分类:幻灯片
代码描述:js+css实现简洁带进度轮播图效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background: #98ede0;
transition: background 500ms;
font-family: ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT", "Arial Rounded MT Bold", Calibri, source-sans-pro, sans-serif;
}
.content {
margin: 0 auto;
max-width: 500px;
height: 100vh;
height: 100svh;
min-height: 400px;
display: flex;
flex-direction: column;
padding: 40px 40px 80px;
justify-content: center;
}
a {
transition: color 200ms;
color: rgba(0, 0, 0, 0.5);
border-radius: 5px;
text-decoration: none;
margin: 40px auto 0;
}
a:hover {
color: black;
text-decoration: underline;
}
a:focus-visible {
color: black;
outline: 3px solid rgba(255, 255, 255, 0.3);
outline-offset: 5px;
}
.pagination {
display: flex;
gap: 10px;
height: 4px;
min-height: 4px;
}
.pagination-item {
border-radius: 100px;
height: 100%;
flex: auto;
background: rgba(0, 0, 0, 0.08);
overflow: hidden;
border: 0;
cursor: pointer;
}
@keyframes progress {
from {
width: 0;
}
to {
width: 100%;
}
}
.pagination-progress {
flex: auto;
background: #333;
height: 100%;
width: 0;
}
.pagination-item--running .pagination-progress {
animation: progress 3s linear forwards;
}
.pagination-item--done .pagination-progress {
width: 100%;
}
.pagination--paused .pagination-progress {
animation-play-state: paused;
}
:-moz-window-inactive .pagination-progress {
animation-play-state: paused;
}
.controls {
display: flex;
justify-content: center;
gap: 12px;
}
.control {
display: flex;
align-items: center;
justify-content: center;
border-radius: 100px;
border: none;
outline: none;
height: 40px;
flex: 40px 0 0;
max-width: 100px;
background: rgba(255, 255, 255, 0.3);
transition: transform 200ms, background-color 200ms;
will-change: transform, background-color;
font-size: 20px;
}
.control:hover {
cursor: pointer;
transform: scale(1.15);
background: rgba(255, 255, 255, 0.45);
}
.control:focus {
background: rgba(255, 255, 255, 0.6);
}
.icon {
width: 20px;
}
.icon--play {
margin-right: -2px;
}
.pagination--paused ~ .controls .icon--pause,
.pagination:not(.pagination--paused) ~ .controls .icon--play {
display: none;
}
.state {
font-size: 120px;
text-align: center;
}
</style>
</head>
<body >
<div class="content">
<div cl.........完整代码请登录后点击上方下载按钮下载查看
网友评论0