1
0
Files
ag-index/assets/css/timeline.css
2025-12-22 15:29:24 +08:00

431 lines
8.6 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ============================================
智慧时间轴组件 - 横向展开式
Smart Timeline Component - Horizontal Expansion
============================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Oswald:wght@400;700&display=swap');
:root {
--tl-bg-color: #f8fafc;
--tl-line-color: rgba(20, 129, 255, 0.3);
--tl-active-color: #1481ff;
--tl-text-color: #2a3e5d;
--tl-year-color: #102541;
--tl-transition-speed: 0.5s;
}
/* Section 容器 */
.timeline-section {
width: 100%;
background-image:
radial-gradient(circle at 10% 20%, rgba(20, 129, 255, 0.08) 0%, transparent 20%),
radial-gradient(circle at 90% 80%, rgba(20, 129, 255, 0.05) 0%, transparent 20%);
font-family: 'Noto Sans SC', sans-serif;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 60px 0;
position: relative;
}
/* 标题样式 */
.timeline-title {
color: var(--tl-year-color);
letter-spacing: 4px;
font-weight: bold;
text-transform: uppercase;
font-size: 36px;
opacity: 0.9;
margin-bottom: 10px;
text-align: center;
}
/* 主容器 */
.timeline-container {
display: flex;
width: 100%;
height: 20vh;
min-height: 500px;
align-items: stretch;
position: relative;
}
/* 主轴线 */
.timeline-line {
position: absolute;
top: 66.67%;
left: 0;
width: 100%;
height: 1px;
background: linear-gradient(90deg,
transparent 0%,
var(--tl-line-color) 5%,
var(--tl-line-color) 95%,
transparent 100%);
z-index: 0;
pointer-events: none;
}
/* 时间节点 */
.timeline-item {
position: relative;
flex: 1;
transition: flex var(--tl-transition-speed) cubic-bezier(0.25, 0.1, 0.25, 1);
border-right: 1px solid rgba(20, 129, 255, 0.1);
cursor: pointer;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
z-index: 1;
}
.timeline-item:last-child {
border-right: none;
}
.timeline-item:hover {
flex: 10;
background: linear-gradient(90deg, rgba(20, 129, 255, 0.08) 0%, transparent 100%);
}
.timeline-container:hover .timeline-item:not(:hover) {
opacity: 0.4;
}
/* 节点圆点 */
.dot {
width: 8px;
height: 8px;
background-color: var(--tl-active-color);
border-radius: 50%;
position: absolute;
top: 66.67%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 0 10px var(--tl-active-color);
transition: all var(--tl-transition-speed);
z-index: 2;
}
.timeline-item:hover .dot {
background-color: var(--tl-active-color);
transform: translate(-50%, -50%) scale(1.5);
box-shadow: 0 0 20px rgba(20, 129, 255, 0.6);
}
/* 竖向年份标签 */
.year-label {
position: absolute;
top: calc(66.67% + 15px);
left: 50%;
transform-origin: 0 0;
transform: rotate(90deg);
font-family: 'Oswald', sans-serif;
font-size: 14px;
color: var(--tl-year-color);
white-space: nowrap;
transition: all 0.3s;
letter-spacing: 1px;
opacity: 0.8;
display: flex;
align-items: center;
gap: 12px;
pointer-events: none;
}
/* 竖向文字中的简短描述 */
.short-desc {
font-family: 'Noto Sans SC', sans-serif;
font-size: 12px;
opacity: 0.6;
font-weight: 300;
letter-spacing: 1px;
}
/* Hover 状态下:标签变大并移到底部背景 */
.timeline-item:hover .year-label {
top: auto;
bottom: -10px;
left: 20px;
transform: rotate(0deg);
font-size: 4rem;
font-weight: 700;
opacity: 0.08;
color: var(--tl-active-color);
pointer-events: none;
}
/* Hover时隐藏简述 */
.timeline-item:hover .short-desc {
display: none;
}
/* 内容区域 - 固定在时间轴线上方 */
.content {
opacity: 0;
transform: translateY(20px);
transition: all 0.4s ease 0.1s;
padding: 0 40px;
color: var(--tl-text-color);
position: absolute;
bottom: 36%;
left: 0;
width: 100%;
text-align: left;
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.timeline-item:hover .content {
opacity: 1;
transform: translateY(0);
}
.content-date {
display: block;
color: var(--tl-active-color);
font-family: 'Oswald', sans-serif;
font-size: 2rem;
margin-bottom: 15px;
font-weight: bold;
text-shadow: 0 0 20px rgba(20, 129, 255, 0.2);
}
.content-text {
font-size:0.9rem;
line-height: 1.8;
border-left: 3px solid var(--tl-active-color);
padding-left: 20px;
max-width: 650px;
background: linear-gradient(90deg, rgba(20, 129, 255, 0.08) 0%, transparent 100%);
padding-top: 10px;
padding-bottom: 10px;
border-radius: 0 4px 4px 0;
}
.content-text p {
margin: 0 0 8px 0;
}
.content-text p:last-child {
margin-bottom: 0;
}
/* 重要节点高亮 */
.timeline-item.highlight .dot {
width: 10px;
height: 10px;
box-shadow: 0 0 15px var(--tl-active-color), 0 0 30px var(--tl-active-color);
}
.timeline-item.highlight .year-label {
color: var(--tl-active-color);
opacity: 1;
}
/* ============================================
自动轮播展开效果与hover效果一致
============================================ */
.timeline-item.auto-expanded {
flex: 10;
background: linear-gradient(90deg, rgba(20, 129, 255, 0.08) 0%, transparent 100%);
}
.timeline-container:has(.auto-expanded) .timeline-item:not(.auto-expanded) {
opacity: 0.4;
}
.timeline-item.auto-expanded .dot {
background-color: var(--tl-active-color);
transform: translate(-50%, -50%) scale(1.5);
box-shadow: 0 0 20px rgba(20, 129, 255, 0.6);
}
.timeline-item.auto-expanded .year-label {
top: auto;
bottom: -10px;
left: 20px;
transform: rotate(0deg);
font-size: 4rem;
font-weight: 700;
opacity: 0.08;
color: var(--tl-active-color);
pointer-events: none;
}
.timeline-item.auto-expanded .short-desc {
display: none;
}
.timeline-item.auto-expanded .content {
opacity: 1;
transform: translateY(0);
}
/* ============================================
响应式设计
============================================ */
@media (max-width: 1200px) {
.timeline-container {
width: 100%;
height: 20vh;
min-height: 500px;
}
.year-label {
font-size: 12px;
top: calc(66.67% + 15px);
}
.short-desc {
font-size: 10px;
}
.content-text {
font-size: 1rem;
max-width: 500px;
}
.content-date {
font-size: 1.6rem;
}
}
@media (max-width: 991px) {
.timeline-section {
padding: 40px 0;
min-height: auto;
height: auto;
}
.timeline-container {
width: 100%;
height: 20vh;
min-height: 500px;
overflow-x: auto;
overflow-y: visible;
-webkit-overflow-scrolling: touch;
}
.timeline-item {
min-width: 80px;
flex: none;
}
.timeline-item:hover {
flex: none;
min-width: 350px;
}
.content {
padding: 0 20px;
}
.content-text {
font-size: 0.9rem;
max-width: 300px;
}
}
@media (max-width: 768px) {
.timeline-title {
font-size: 18px;
letter-spacing: 2px;
margin-bottom: 30px;
}
.timeline-container {
height: 70vh;
}
.timeline-item {
min-width: 60px;
}
.timeline-item:hover {
min-width: 280px;
}
.year-label {
font-size: 11px;
}
.short-desc {
font-size: 9px;
display: none;
}
.content {
padding: 0 15px;
}
.content-date {
font-size: 1.4rem;
margin-bottom: 10px;
}
.content-text {
font-size: 0.85rem;
padding-left: 15px;
max-width: 250px;
}
.dot {
width: 6px;
height: 6px;
}
}
@media (max-width: 576px) {
.timeline-section {
padding: 30px 0;
}
.timeline-title {
font-size: 16px;
letter-spacing: 1px;
}
.timeline-container {
height: 60vh;
}
.timeline-item {
min-width: 50px;
}
.timeline-item:hover {
min-width: 220px;
}
.year-label {
font-size: 10px;
top: calc(66.67% + 12px);
}
.content-date {
font-size: 1.2rem;
}
.content-text {
font-size: 0.8rem;
line-height: 1.6;
}
.timeline-item:hover .year-label {
font-size: 2.5rem;
bottom: -30px;
left: 10px;
}
}