html实现会拐弯的时间线,jquery实现会拐弯的时间线,css实现会拐弯的时间线

news2024/9/20 8:00:52

前言

jquery + html + css实现一个会拐弯的时间线
基于此网址整改,参考:https://www.jq22.com/webqd5873

效果

在这里插入图片描述

实现

基于jQuery,需要引入jQuery.js,没有必要使用太高版本,够用就行
jquery下载:https://www.jb51.net/zt/jquerydown.htm

html中

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="css/timeLine.css" />
	</head>

	<body>

		<div class="clearfix time-wrapper"></div>
		<div style="padding: 20px;margin-top: 100px">
			<p>输入数量,生成时间线</p>
			<input type="number" class="test" value="0">
			<button id="btn">生成</button>
		</div>

	</body>
	<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="js/timeLine.js"></script>

</html>

css中

* {
	word-wrap:break-word
}
html,body,h1,h2,h3,h4,h5,h6,hr,p,,dl,dt,dd,ul,ol,li,pre,form,button,input,textarea,th,td,fieldset {
	margin:0;
	padding:0
}
ul,ol,dl {
	list-style-type:none
}
html,body {
	*position:static
}
html {
	font-family:sans-serif;
	-webkit-text-size-adjust:100%;
	-ms-text-size-adjust:100%
}
address,caption,cite,code,dfn,em,th,var {
	font-style:normal;
	font-weight:400
}
input,button,textarea,select,optgroup,option {
	font-family:inherit;
	font-size:inherit;
	font-style:inherit;
	font-weight:inherit
}
input,button {
	overflow:visible;
	vertical-align:middle;
	outline:none
}
body,th,td,button,input,select,textarea {
	font-family:"Microsoft Yahei","Hiragino Sans GB","Helvetica Neue",Helvetica,tahoma,arial,Verdana,sans-serif,"WenQuanYi Micro Hei","\5B8B\4F53";
	font-size:14px;
	color:#333;
	-webkit-font-smoothing:antialiased;
	-moz-osx-font-smoothing:grayscale
}
h1,h2,h3,h4,h5,h6 {
	font-size:100%
}
a,area {
	outline:none;
	blr:expression(this.=this.blur())
}
a {
	text-decoration:none;
	cursor:pointer
}
a:hover {
	text-decoration:underline;
	outline:none
}
a.ie6:hover {
	zoom:1
}
a:focus {
	outline:none
}
a:hover,a:active {
	outline:none
}
:focus {
	outline:none
}
sub,sup {
	vertical-align:baseline
}
button,input[type="button"],input[type="submit"] {
	line-height:normal !important
}
/*img*/
img {
	border:0;
	vertical-align:middle
}
a img,img {
	-ms-interpolation-mode:bicubic
}
.img-responsive {
	max-width:100%;
	height:auto
}
/*IE下a:hover 背景闪烁*/
*html {
	overflow:-moz-scrollbars-vertical;
	zoom:expression(function(ele) {
	ele.style.zoom = "1";
	document.execCommand("BackgroundImageCache",false,true)
}
(this))}/*HTML5 reset*/
header,footer,section,aside,details,menu,article,section,nav,address,hgroup,figure,figcaption,legend {
	display:block;
	margin:0;
	padding:0
}
time {
	display:inline
}
audio,canvas,video {
	display:inline-block;
	*display:inline;
	*zoom:1
}
audio:not([controls]) {
	display:none
}
legend {
	width:100%;
	margin-bottom:20px;
	font-size:21px;
	line-height:40px;
	border:0;
	border-bottom:1px solid #e5e5e5
}
legend small {
	font-size:15px;
	color:#999
}
svg:not(:root) {
	overflow:hidden
}
fieldset {
	border-width:0;
	padding:0.35em 0.625em 0.75em;
	margin:0 2px;
	border:1px solid #c0c0c0
}
input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button {
	height:auto
}
input[type="search"] {
	-webkit-appearance:textfield;
	/* 1 */-moz-box-sizing:content-box;
	-webkit-box-sizing:content-box;
	/* 2 */box-sizing:content-box
}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration {
	-webkit-appearance:none
}
/*
Name:style_clearfix
Example:class="clearfix|cl"
Explain:Clearfix(简写cl)避免因子元素浮动而导致的父元素高度缺失能问题
*/
table {
	border-collapse:collapse;
	border-spacing:0;
}
input:hover {
	border:1px solid #067BBB!important;
}
input:focus {
	border:1px solid #067BBB;
	outline:0;
}
.cl:after,.clearfix:after {
	content:".";
	display:block;
	height:0;
	clear:both;
	visibility:hidden
}
.cl,.clearfix {
	zoom:1
}
.btn {
	border:none;
	border-radius:4px;
	cursor:pointer;
}
.form-control {
	display:inline-block;
	width:100%;
	height:34px;
	margin:0 auto;
	box-sizing:border-box;
	padding:6px 12px;
	font-size:14px;
	line-height:34px;
	color:#555;
	background-color:#fff;
	background-image:none;
	border:1px solid #ccc;
	border-radius:4px;
	-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);
	box-shadow:inset 0 1px 1px rgba(0,0,0,.075);
	-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
	-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;
	transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
.btn-primary {
	background:rgb(46,117,183);
	color:#FFFFFF;
}
.btn-primary:hover {
	background:rgba(46,117,183,0.8);
}
.btn-default {
	background:#FFFFFF;
	border:1px solid #c9c9c9;
}
.left {
	float:left;
}
.right {
	float:right;
}
.time-wrapper {
	width:100%;
	padding:40px 60px;
	padding-top:100px;
	box-sizing:border-box;
}
.time-wrapper>div {
	width:100%;
	position:relative;
	margin-top:-2px;
}
.time-wrapper>div.first-group {
	margin-top:80px;
}
.odd-group .left-arrow {
	display:none;
	min-height:190px;
}
.odd-group .right-arrow {
	min-height:190px;
}
.even-group .right-arrow {
	display:none;
	min-height:190px;
}
.right-arrow {
	width: 190px;
    border-top-right-radius: 50%;
    border-bottom-right-radius: 50%;
	border:2px solid #597dff;
	border-left:none;
	min-height:130px;
	box-sizing:border-box;
	float:right;
	position: relative;
    right: -58px;
}
.left-arrow {
	width: 190px;
    border-top-left-radius: 50%;
    border-bottom-left-radius: 50%;
	border:2px solid #597dff;
	border-right:none;
	min-height:130px;
	box-sizing:border-box;
	float:left;
	position: relative;
    left: -58px;
}
.even-group .left-arrow {
	min-height:190px;
}
.odd-group .time-detail {
	position:absolute;
	left:30px;
	right:30px;
	top:-122px;
}
.even-group .time-detail {
	position:absolute;
	left:30px;
	right:30px;
	top: -122px;
}
.g-line {
	height:2px;
	background:#597dff;
	position:absolute;
	left:30px;
	right:30px;
	top:0;
}
.time-detail .detail-c {
	width:20%;
	box-sizing:border-box;
	float:left;
	position:relative;
	padding:0 10px;
}
.floatRight .detail-c {
	float:right;
}
.time-detail .detail-c .circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #597dff;
    box-sizing: border-box;
    position: absolute;
    z-index: 99;
    background: #ffffff;
    bottom: -18px;
    top: auto;
}
.odd-group .circle {
	bottom:-19px;
}
.even-group .circle {
	top:-18px;
}
.time-detail .detail-c .circle .circle-son {
	width:6px;
	height:6px;
	border-radius:50%;
	background:#597dff;
	box-sizing:border-box;
	margin:2px;
}
.detail-m {
    max-width: 100%;
    display: inline-block;
    padding: 10px;
    background: #fbfbfb;
    box-sizing: border-box;
    border-radius: 5px;
    height: 110px;
   	background: #fff;
    box-shadow: #00000015 0 2px 5px 0;
}
.detail-m h3 {
	font-weight:bold;
}
.detail-m p {
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
}
.floatLeft .detail-c {
	float:left;
}
.disappear {
	display:none!important;
}

js中

$(function() {
    timeLine(6);
    $("#btn").click(function() {
        timeLine($(".test").val())
    })
})

function timeLine(num) {
    var timeHtml = '';
    var numUp = Math.ceil(num / 5);
    for (var i = 0; i < numUp; i++) {
        if ((i + 1) % 2 == 1 && i == 0) {
            timeHtml += '<div class="odd-group floatLeft first-group clearfix">'
        } else if ((i + 1) % 2 == 1) {
            timeHtml += '<div class="odd-group floatLeft clearfix">'
        } else {
            timeHtml += '<div class="even-group floatRight clearfix">'
        }
        timeHtml += '<div class="left-arrow"></div><div class="g-line"></div><div class="right-arrow"></div><div class="time-detail clearfix">'
        for (var j = 5 * i; j < 5 * (i + 1); j++) {
            if (j < num) {
                timeHtml += '<div class="detail-c">' +
                    '<div class="detail-m">' +
                    '<h3>' + (j + 1) + '</h3>' +
                    '<p>这里可以填充你需要的内容 (。・ω・。)ノ♡</p>' +
                    '</div>' +
                    '<div class="circle">' +
                    '<div class="circle-son"></div>' +
                    '</div>' +
                    '</div>'
            }
        }
        timeHtml += '</div></div>'
    }
    $(".time-wrapper").html(timeHtml);
    if ($(".time-wrapper>div:last-child").hasClass("even-group")) {
        $(".time-wrapper>div:last-child").find(".left-arrow").hide()
    } else if ($(".time-wrapper>div:first-child").hasClass("odd-group")) {
        $(".time-wrapper>div:last-child").find(".right-arrow").hide()
    }
    var circle = $(".circle");
    $(circle[0]).children(".circle-son").hide();
    $(circle[circle.length - 1]).children(".circle-son").hide();
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/584227.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SadTalker 学习笔记

SadTalker: Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation 摘要 Generating talking head videos through a face image and a piece ofspeech audio still contains many challenges. i.e., unnatural head mo…

前端页面调用EXE应用程序

文章目录 1️⃣ 操作步骤1.1 操作注册表1.1.1 创建 xcLeigh.reg 注册表文件1.1.2 安装 xcLeigh.reg 注册表文件1.1.3 放入EXE文件 1.2 界面代码1.3 运行效果 优质资源分享 作者&#xff1a;xcLeigh 文章地址&#xff1a;https://blog.csdn.net/weixin_43151418/article/details…

大专毕业,从6个月开发转入测试岗位的一些感悟 —— 写在测试岗位3年之际

时光飞逝&#xff0c;我从前端开发岗位转入测试岗位已经三年了&#xff0c;这期间从迷茫到熟悉&#xff0c;到强化&#xff0c;到熟练&#xff0c;到总结&#xff0c;感受还是很深的&#xff01; 三年前的某一个晚上&#xff0c;我正准备下班回家&#xff0c;我们的项目经理把…

嵌入式Linux中的 gpio、gpiod基本分析

GPIO 应该是每个嵌入式设备都避免不了的。最近在做项目的时候&#xff0c;也遇到这方面的问题&#xff0c;所以简单总结一下。 现在内核里面多了 gpiod 的来控制 gpio 口&#xff0c;相对于原来的形式&#xff0c;使用 gpiod 的好处是我们申请后不进行 free 也没有什么问题。但…

Seata分布式事务AT、TCC、SAGA、XA模式

Seata是一款开源的分布式事务解决方案&#xff0c;致力于提供高性能和简单易用的分布式事务服务。Seata将为用户提供了AT、TCC、SAGA和XA事务模式&#xff0c;为用户打造一站式的分布式解决方案。 AT模式 &#x1f36e;实现原理 阿里SEATA独有模式&#xff0c;通过生成反向SQ…

STM32读取24位模数转换(24bit ADC)芯片ADS1231数据

STM32读取24位模数转换&#xff08;24bit ADC&#xff09;芯片ADS1231数据 ADS1231是一款TI公司出品的24位ADC芯片&#xff0c;常用于与称重传感器配合实现体重计的应用。这里介绍STM32读取ADS1231的电路和代码实现。ADS1231的特点为通过硬件管脚可控制两种采样速率&#xff0…

日期与字符串相互转化(自定义日期工具类总结,Hutool工具类使用)

一、将日期格式化成字符串输出&#xff08;Date转String&#xff09; Java旧的时间API饱受诟病&#xff0c;Java8以后提供了新的时间API&#xff0c;在java.time包下。 //获取当前时间LocalDateTime dateLocalDateTime.now();//创建日期时间对象格式化器&#xff0c;日期格式类…

Hadoop学习---11、HA高可用

1、Hadoop HA高可用 1.1 HA概述 1、所谓HA&#xff08;High Availablity&#xff09;&#xff0c;即高可用&#xff08;7 * 24小时不中断服务&#xff09;。 2、实现高可用最关键的策略是消除单点故障。HA严格来说应该分成各个组件的HA机制&#xff1a;HDFS的HA和YARN的HA。 …

数字化转型,低代码开发真的靠谱?

关于数字化转型&#xff0c;有这么一种定义&#xff0c;即利用数字化技术和能力来驱动企业商业模式创新和商业生态系统重构的一种途径与方法。通俗点说&#xff0c;数字化的核心和目的就是通过数字化技术&#xff0c;实现业务的转型、创新和增长&#xff0c;提供新的营收点与价…

超详细,性能测试三大模式详解,资深测试老鸟一文道破...

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 在性能测试工作中…

IC芯片自动测试系统平台ATECLOUD:提高半导体制造效率与质量

近年来&#xff0c;随着半导体产业的快速发展&#xff0c;IC芯片在各种电子设备中扮演着越来越重要的角色。然而&#xff0c;为了满足不断增长的需求和保持竞争力&#xff0c;制造商需要不断提高生产效率并确保产品质量。ATECLOUD——一款基于云计算技术的IC芯片自动测试系统平…

租赁小程序|人车网租赁系统|电动车租赁系统包含哪些功能?

随着科技不断完善&#xff0c;租赁行业的发展也越来越好&#xff0c;电动车也开始进行线上推广租赁&#xff0c;不仅可以让人们更加方便的租用电动车&#xff0c;还让商家可以通过线上模式带动线下的经营&#xff0c;不同于传统的汽车租赁&#xff0c;用户只要打开手机就可以进…

MySQL-5.7.19版本安装详解

MySQL-5.7.19版本安装详解 1. 软件下载 Mysql5.7地址&#xff1a;https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-winx64.zip 2. 软件安装 2.1 第一步&#xff1a;解压 下载后会得到mysql-5.7.19-winx64的zip 安装文件&#xff0c;先将其解压解压的路径最好不…

微信小程序导入Vant Weapp ui组件库2023年最新版

微信小程序导入Vant Weapp ui组件库2023年最新版 写这篇文章的原因是Vant Weapp的官方文档快速上手是有一定的问题的&#xff0c;没错&#xff0c;我就是那个试错的人&#xff0c;弄了一下午才发现问题所在&#xff0c;所以写了一篇正确的导入教程。 第一步&#xff1a;在项目…

Python进阶 │反爬虫和怎样反反爬虫

爬虫、反爬虫和反反爬虫是网络爬虫工作过程中一直伴随的问题。 在现实生活中&#xff0c;网络爬虫的程序并不像之前介绍的爬取博客那么简单&#xff0c;运行效果不如意者十有八九。首先需要理解一下“反爬虫”这个概念&#xff0c;其实就是“反对爬虫”。根据网络上的定义&…

PowerShell:因为在此系统上禁止运行脚本,解决方法

运行powershell脚本遇见报错&#xff1a; 无法加载文件 C:\Users\DH\Desktop\cs\rename.ps1&#xff0c;因为在此系统上禁止运行脚本。有关详细信息&#xff0c;请参阅 https:/go.microsoft.com/fwlink/?LinkID135170 中的 about_Execution_Policies。 查了查之后发现是在计算…

差动测试棒如何连接到示波器

差动测试棒提供一个安全的绝缘仪器给示波器使用&#xff0c;它可以转换由高输入的差动电压进入一个低电压并且显示波形在示波器上&#xff0c;使用频率高达100MHz&#xff0c;非常适合大电力测试、研发使用。 差动测试棒输出标是设计在操作示波器1MΩ的输入阻抗的相对衰减量&a…

人工智能学习07--pytorch20--目标检测:COCO数据集介绍+pycocotools简单使用

如&#xff1a;天空 coco包含pascal voc 的所有类别&#xff0c;并且对每个类别的标注目标个数也比pascal voc的多。 一般使用coco数据集预训练好的权重来迁移学习。 如果仅仅针对目标检测object80类而言&#xff0c;有些图片并没有标注信息&#xff0c;或者有错误标注信息。…

需求:js给html添加css

目前发送请求&#xff0c;请求回html&#xff1a;<div class"articleRecommendation_con"> <a href"https://weekly.caixin.com/2023-05-26/102059365.html"><img src"https://img.caixin.com/2023-05-27/168515251870385…

如何选择适合平台的直播美颜SDK:从技术和商业角度考虑

直播美颜SDK作为一种技术解决方案&#xff0c;可以帮助直播应用实现优秀的美颜效果&#xff0c;提高用户体验和粘性。然而&#xff0c;如何选择适合你应用的直播美颜SDK&#xff0c;需要从技术和商业角度综合考虑。本文将从这两个角度出发&#xff0c;为你介绍如何选择适合你应…