jQuery纵向时间轴是一种使用jQuery库创建的可视化时间线,它允许用户以垂直方向浏览和交互时间序列数据。这种时间轴通常用于展示历史事件、项目进度、里程碑或其他按时间顺序排列的信息。
以下是一个简单的jQuery纵向时间轴示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery Vertical Timeline</title>
<style>
.timeline {
list-style: none;
padding: 0;
position: relative;
}
.timeline:before {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 6px;
background: #ddd;
left: 50%;
margin-left: -3px;
}
.timeline li {
position: relative;
margin-bottom: 20px;
}
.timeline li:before {
content: attr(data-date);
position: absolute;
top: -30px;
left: 50%;
transform: translateX(-50%);
font-weight: bold;
}
.timeline li .timeline-content {
background: #fff;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
</style>
</head>
<body>
<ul class="timeline">
<li data-date="2020-01-01">
<div class="timeline-content">
<h3>Event 1</h3>
<p>Description of event 1...</p>
</div>
</li>
<li data-date="2020-02-01">
<div class="timeline-content">
<h3>Event 2</h3>
<p>Description of event 2...</p>
</div>
</li>
<li data-date="2020-03-01">
<div class="timeline-content">
<h3>Event 3</h3>
<p>Description of event 3...</p>
</div>
</li>
</ul>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
// 可以在这里添加更多的交互逻辑
});
</script>
</body>
</html>margin-bottom或padding属性。通过以上步骤,你可以创建一个基本的jQuery纵向时间轴,并根据需要进行定制和扩展。
没有搜到相关的文章