CSS之实现垂直时间线展示相关内容效果
如下,最近在工作中遇到实现时间线效果的需求,用纯css即可实现,下面给出详细实现代码。
html:
<div class="time_line_list_wrap hide">
<ul class="time_line">
<li>
<div class="time_line_item_wrap">
<span class="time">00:00:00</span>
</div>
</li>
<li class="time_line_item_tmpl">
<div class="time_line_item_wrap">
<span class="time"></span>
<div class="time_item_contain_wrap">
<img class="ppt_item_img_left">
<div class="item_contain_right">
<p class="ppt_name">中文课件名称超过了一定长度的字之后隐藏</p>
<span class="item_page_number">2/30</span>
</div>
</div>
</div>
</li>
</ul>
</div>
css:(此处用的less语法)
.time_line_list_wrap{
width: 100%;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
background-color: #ffffff;
padding:;
flex-grow:; .time_line{
padding: 16px 10px 0px 10px;
li{
list-style-type: none;
position: relative;
width: 2px;
height: 102px;
background-color: #e6e6e6; &.time_line_item_tmpl{
display: none;
} &:last-child{
height: 0px;
} &:first-child{
height: 30px;
} &:before{
content: '';
position: absolute;
left: 50%;
top:;
transform: translateX(-50%);
width: 8px;
height: 8px;
border-radius: 50%;
background: inherit;
} .time_line_item_wrap {
width: 280px;
margin-left: 10px;
position: relative;
bottom: 6px; &:last-child{
margin-bottom: 20px;
} &:first-child{
margin-bottom: 0px;
} .time{
display: inline-block;
width: 92px;
height: 20px;
line-height: 20px;
font-size: 12px;
color: #4a90e2;
box-sizing: border-box;
padding-left: 10px;
}
.time_item_contain_wrap{
display: flex;
padding: 10px 0 10px 9px; .ppt_item_img_left{
width: 80px;
height: 62px;
object-fit: contain;
flex-shrink:;
} .item_contain_right{
font-size: 12px;
color: #696969;
font-weight:;
margin-left: 8px;
width: 68%; .ppt_name{
.text-autocut();
}
}
}
}
}
} &.hide{
display: none;
}
}
js:
const $timeLineUl = $('.time_line')
const $timeLineItemTmpl = $('.time_line_item_tmpl').clone().removeClass('time_line_item_tmpl') // 初始化侧边栏中时间线数据
for (let i = 0; i < slideInfo.length; i += 1) {
const currentSlide = slideInfo[i]
const $timeLineItem = $timeLineItemTmpl.clone()
$timeLineItem.find('.time').text(formatTime(currentSlide.recordTime / 1000).join(':'))
$timeLineItem.find('.time').css({
background: `url(${triangleTimeStr}) no-repeat center`,
})
$timeLineItem.find('.ppt_item_img_left').attr('src', currentSlide.slideUrl)
$timeLineItem.find('.ppt_name').text(currentSlide.slideName)
$timeLineItem.find('.item_page_number').text(`${currentSlide.currentPageNumber}/${currentSlide.totalPageNumber}`)
$timeLineUl.append($timeLineItem)
}
注意此处,需要用find()方法来查找后代元素,.children()方法是查找直接后代(儿子辈)的元素,.find()方法是查找所有后代元素(包括儿子、孙子、孙子的孙子及更多)。
CSS之实现垂直时间线展示相关内容效果的更多相关文章
- 一款纯css实现的垂直时间线效果
今天给大家分享一款纯css实现的垂直时间线效果.垂直时间线适合放在类似任务时间安排的网页上.该实现采用了蓝色作为主题色,界面效果还不错.一起看下效果图: 实现的代码. html代码: ... 阅读原文 ...
- 纯css实现同一页面下选择之后更换内容效果
实现效果为如下:在同一页面下,当我选中输入手机号时,出现手机号输入框,当我选中输入验证码时,出现验证码输入框,当我选中设置密码时,出现密码框 在这里有一个小技巧,就是 1.对下面的输入框设置同样的样 ...
- 腾讯微博API时间线相关接口返回的微博信息中head值使用问题
腾讯微博API时间线相关接口返回的微博信息中head值表示作者头像url,这个链接直接访问并不能使用,需要再附加一个参数指定图片的大小(100.50),比如:[head]/100.
- moviepy音视频剪辑:与time时间线相关的变换函数freeze_region、make_loopable、speedx、time_mirror、time_symmetrize介绍
☞ ░ 前往老猿Python博文目录 ░ 一.引言 在<moviepy音视频剪辑:moviepy中的剪辑基类Clip详解>介绍了剪辑基类的fl.fl_time.fx方法,在<movi ...
- echarts的时间线图表
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...
- Layui选项卡、进度条、面板、徽章、时间线、辅助元素
Layui选项卡.进度条.面板.徽章.时间线.辅助元素 Tab选项卡 - 页面元素 导航菜单可应用于头部和侧边,Tab选项卡提供多套风格,支持响应式,支持删除选项卡等功能.面包屑结构简单,支持自 ...
- 《时间线》:WWT 数字宇宙,虚拟星空
李北辰/文 王尔德说:我们生活在阴沟里,却仍有人仰望星空.如今,这句感叹依旧代表某种程度的正确,但这位19世纪的英国绅士有所不知:在一百多年后的东方"帝都",当困于阴沟中的年轻人们 ...
- WPF中的动画——(三)时间线(TimeLine)
WPF中的动画——(三)时间线(TimeLine) 时间线(TimeLine)表示时间段. 它提供的属性可以让控制该时间段的长度.开始时间.重复次数.该时间段内时间进度的快慢等等.在WPF中内置了如下 ...
- 如何解决Angular网页内嵌推特时间线无法正常显示
我最近解决了一个折磨了我好久但是解决方法却只是添加两三行代码的问题.我没有在网上找到合适的解决方案,最后是我根据官方网站和很多的帖子里的部分代码得到的启发,尝试了很久之后得到的解决方法.因为过程实在是 ...
随机推荐
- CSAPP:第二章学习笔记:斗之气2段
一.字长:虚拟地址通过一个字来编码,字长为32位,则可以标识2^32个地址空间,每个空间为一个字节,故为4G 二.字节序:当解释多个字节类型时,存在大小端字节序问题 0x1234567,在大小端表示法 ...
- 用php实现表格
<?php $contact2 =[ ['江苏'=>['华罗庚','河南','童第周']], ['河南'=>['童第周','华罗庚','河南']], ['河北'=>['刘恒', ...
- 第九届蓝桥杯C/C++B组省赛感想
因为做了近三年的初赛题,都对了5题+,所以这次比赛前信心满满,心里想最少水个省二没问题.可我怎么知道今年的套路居然和以前不一样了!一题深搜都没有,想想一周前做的第七届初赛题,10题有3.4题深搜题. ...
- 在Ubuntu中,vi命令编辑异常
在Ubuntu中,进入vi命令的编辑模式,发现按方向键不能移动光标,而是会输出ABCD,以及退格键也不能正常删除字符.这是由于Ubuntu预装的是vim-tiny,而我们需要使用的是vim-full, ...
- 大数开方 ACM-ICPC 2018 焦作赛区网络预赛 J. Participate in E-sports
Jessie and Justin want to participate in e-sports. E-sports contain many games, but they don't know ...
- Hibernate的load和get方法的区别
这次我们聊一下Hibernate3.2 Session加载数据时get和load方法的区别,我总结的如下: 1. 对于get方法,hibernate会确认一下该id对应的数据是否存在,首先在sessi ...
- 2018-2019-20175205实验二面向对象程序设计《Java开发环境的熟悉》实验报告
2018-2019-20175205实验二面向对象程序设计<Java开发环境的熟悉>实验报告 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)>< ...
- 20165305 《网络对抗技术》 Kali安装
一.安装kali 在虚拟机中安装kali我参考了下面的网页,里面写的很全面,所以我就不重复了,我主要说一下kali里面的环境配置. 在虚拟机中安装kali linux 注意:输入用户和密码时,kali ...
- spring boot常见问题
1.什么是springboot 用来简化spring应用的初始搭建以及开发过程 使用特定的方式来进行配置(properties或yml文件) 创建独立的spring引用程序 main方法运行 嵌入的T ...
- 2018-2019-2 20165316 《网络对抗技术》 Exp6 信息搜集与漏洞扫描
2018-2019-2 20165316 <网络对抗技术> Exp6 信息搜集与漏洞扫描 1.实践目标 掌握信息搜集的最基础技能与常用工具的使用方法. 2.实践内容 (1)各种搜索技巧的应 ...