效果预览图:

html:

<div class="tim">
<div class="timdiv">
<div class="timimg">
<div class="huadiv"><div></div></div>
</div>
<div class="timli timliclick">
<div class="kuai"></div>
<div class="datatime">2019-05</div>
</div>
<div class="timli">
<div class="kuai"></div>
<div class="datatime">2019-07</div>
</div>
<div class="timli">
<div class="kuai"></div>
<div class="datatime">2019-09</div>
</div>
<div class="timli">
<div class="kuai"></div>
<div class="datatime">2019-11</div>
</div>
</div>
<div class="timpage timpageup"></div>
<div class="timpage timpagedw"></div>
</div>

css:

body{
background: #ccc;
width: 100%;
height: 100%;
}
.tim{
width: 1300px;
height: 20px;
position: absolute;
top: 30px;
left: 0;
text-align: center
}

.timpage{
width: 22px;
height: 46px;
position: absolute;
top: 0px;
background: url(img/timup.png) no-repeat;
cursor: pointer;
}

.timpage:hover{
background: url(img/timuph.png) no-repeat;
}

.timpageup{
left: 0px;
}
.timpagedw{
transform: rotate(180deg);
right: 0px;
}
.timdiv{
width: 1250px;
height: 46px;
position: relative;
margin: 0 auto;
}
.timimg{
width: 1250px;
height: 46px;
background: url(img/timexy.png) no-repeat center;
z-index: 3;
position: relative;
}
.huadiv{
width: 220px;
height: 20px;
border: 1px solid deepskyblue;
position: absolute;
top: 12px;
left: 125px;
box-sizing: border-box;
background: aqua;
padding: 3px 0px;
box-shadow: 0px 0px 11px -2px deepskyblue;
}
.huadiv div{
width: 100%;
height: 100%;
/*background: deepskyblue;*/
}

.timli{
/*width: 2px;*/
height: 27px;
position: absolute;
top:13px;
background: #005881;
z-index: 2;
}
.kuai{
width: 2px;
height: 5px;
background: deepskyblue;
position: absolute;
top: 22px;
left: 0px;
}
.datatime{
cursor: pointer;
width: 120px;
height: 40px;
text-align: center;
line-height: 40px;
color: #ffffff;
font-size: 24px;
position: absolute;
top: 32px;
left: 50%;
margin-left: -60px;
border-radius: 3px;
/*background: deepskyblue;*/
}
.datatime:hover{
color: #000b13;
background: deepskyblue;
}

.timliclick .kuai{
width: 6px;
height: 13px;
background: deepskyblue;
top: 19px;
left: -2px;
}
.timliclick .datatime{
color: #000b13;
background: deepskyblue;
}

.timli:nth-child(2){
left: 315px;
}
.timli:nth-child(3){
left: 560px;
}
.timli:nth-child(4){
left: 795px;
}
.timli:nth-child(5){
left: 1050px;
}

JS:

$(".timli").click(function(){
var numli=$(this).index()-1;
console.log(numli);
var leftn=125+numli*250;
var eli=$(this);
console.log(eli);
$(".timli").removeClass("timliclick");
$(".huadiv").animate({
left:leftn+"px"

},500,function(){
eli.addClass("timliclick");
});
})
$(".timpagedw").click(function(){
if($(".timliclick").next().length>0){
$(".timliclick").next().click();
}
});
$(".timpageup").click(function(){
if($(".timliclick").prev().length>0){
$(".timliclick").prev().click();
}
})

小白一枚,路过大神多多指教。欢迎留下宝贵意见。如有问题欢迎指出(*  *)<==>(& &)

另附护眼图一张哈哈:

jquery-时间轴滑动的更多相关文章

  1. 推荐5款实用的jQuery时间轴插件

    1.使用CSS3和jQuery制作的水平时间轴 这是一个可以在PC和移动端表现非常棒的水平时间轴,它由上部水平滑块和下部时间点对应的内容区块,点击时间轴上的时间点,下部内容会滑动到对应的内容区块.使用 ...

  2. jquery时间轴幻灯展示源代码

    查看效果:http://hovertree.com/texiao/jquery/75/ 源代码下载:http://hovertree.com/h/bjaf/8jlpc2wu.htm 效果图如下: 代码 ...

  3. jQuery时间轴插件timeline.js

    http://www.jq22.com/jquery-info13695 http://www.jq22.com/jquery-info13357 简要教程 timeline.js是一款jQuery时 ...

  4. 发展简史jQuery时间轴特效

    发展简史jQuery时间轴特效.这是一款鼠标滚动到一定的高度动画显示企业发展时间轴特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="wr ...

  5. jquery时间轴tab切换效果实现结合swiper实现滑动显示效果

    需求:根据时间轴进行tab页面内容切换(时间轴需要滑动查看并选择) 实现思路: 结合swiper插件实现滑动显示效果 根据transform: translateX进行左侧切换效果的实现(具体实现cs ...

  6. jQuery时间轴插件:jQuery Timelinr

    前言 这是一款可用于展示历史和计划的时间轴插件,尤其比较适合一些网站展示发展历程.大事件等场景.该插件基于jQuery,可以滑动切换.水平和垂直滚动.支持键盘方向键.经过扩展后可以支持鼠标滚轮事件. ...

  7. jQ效果:jQuery时间轴插件jQuery Timelinr

    前言 这是一款可用于展示历史和计划的时间轴插件,尤其比较适合一些网站展示发展历程.大事件等场景.该插件基于jQuery,可以滑动切换.水平和垂直滚动.支持键盘方向键.经过扩展后可以支持鼠标滚轮事件. ...

  8. jQuery时间轴

    常见的时间轴导航 横向时间轴

  9. JQuery时间轴timeline插件的学习-Lateral On-Scroll Sliding with jQuery+technotarek / timeliner

    一.Lateral On-Scroll Sliding with jQuery的使用 View demo      Download source 1. HTML结构 <div id=" ...

  10. Echart横坐标时间轴滑动

    主要针对于dataZoom的使用,代码如下: option = { title: { text: '未来一周气温变化', subtext: '纯属虚构' }, tooltip: { trigger: ...

随机推荐

  1. apue 在 mac 环境编译错误

    参考资料:https://unix.stackexchange.com/questions/105483/compiling-code-from-apue 笔者使用 mac 学习 apue, 在编译的 ...

  2. iframe根据子frame的高度自动高度

    <script type="text/javascript"> //光标移动到顶部 this.to_top=function(){ $("html,body& ...

  3. postman杂记

    接到测试任务,测试6个接口 rap2 上的接口比较多,整体导出内容太多 就一个接口一个接口的,复制到了postman上 rap2部分接口,开发没有备注简介内容:通知开发备注下 对接口的理解,还是靠功能 ...

  4. TensorFlow2.0矩阵与向量的加减乘

    1.矩阵加法使用 a = np.random.random((3,3))b = np.random.randint(0,9,(3,3)) ad = tf.add(a,b) 2.矩阵乘法注意 # ten ...

  5. 使用Dockerfile制作镜像

    组成部分 基础镜像信息       FROM 维护者信息    MAINTAINER.LABEL 镜像操作指令       RUN.COPY.ADD.EXPOSE.WORKDIR.ONBUILD.US ...

  6. ContextLoaderListener错误

    在web.xml中添加如下配置 <context-param> <param-name>contextConfigLocation</param-name> < ...

  7. 【7.10校内test】T3经营与开发

    [题目链接luogu] 它……又是个DP 我……我讨厌DP!? 然后又是读入,显然用快读啊:(数据范围还是很大的)(习惯) 然后我们发现,不论是损耗值维修值,还是采矿所得,维修花费,都带着个p,因此我 ...

  8. 数位DP 计划

    通常的数位dp可以写成如下形式: [cpp] view plain copy int dfs(int i, int s, bool e) { if (i==-1) return s==target_s ...

  9. shell学习笔记2---执行Shell脚本(多种方法)

    在新进程中运行 Shell 脚本 1) 将 Shell 脚本作为程序运行 切换到脚本所在位置(还要给脚本加上可执行权限) [mozhiyan@localhost demo]$ ./test.sh #执 ...

  10. RouteReuseStrategy angular路由复用策略详解,深度刨析路由复用策略

    关于前端路由复用策略网上的文章很多,大多是讲如何实现tab标签切换历史数据,至于如何复用的原理讲的都比较朦胧,代码样例也很难适用各种各样的路由配置,比如懒加载模式下多级嵌套路由出口网上的大部分代码都会 ...