星空网 > 软件开发 > 网页设计

纯css+js水平时间轴

自定义,并自动加载时间节点

当前时间节点居中,突出显示

时间动态无痕添加

效果图:

纯css+js水平时间轴

初始状态

 

纯css+js水平时间轴

时间左走到一定2016.1月后

html:

<!-- 水平时间轴 -->
<div id="timeline" >
<ul id="dates" ></ul>
<ul id="issues" >
</ul>
<div id="grad_left" >
</div>
<div id="grad_right" ></div>
<a href="#" id="next" >+</a>
<a href="#" id="prev" >-</a>
</div>
<!-- End水平时间轴 -->

 

对应 JS 设置处理:

var left = document.getElementById(datesDiv).offsetLeft + parseInt($("#" + datesDiv).parent().css('background-position-y')) + $("#" + datesDiv).children().width();
var newYear = parseInt($("#dates li:first-child a").attr('year')) - 1;
if (left > 0) {
var datesLi = "";
for (var i = 1; i <= 12; i++) {
datesLi += "<li><a href=\"javascript:void();\" onclick=\"chooseMonth('" + newYear + "','" + i + "')\" year=" + newYear + " month=" + i + ">" + newYear + "." + i + "</a></li>";
}
$("#dates").width($("#dates").width() + 12 * $("#" + datesDiv).children().width());
$("#dates li:first-child").before($(datesLi));
//$().timelinr({ arrowKeys: 'true' });//在源码中,click事件用on绑定到a上,此处不用重新初始化
}

 

 

资料下载:链接: http://pan.baidu.com/s/1o8lezNG 密码: 7q6n




原标题:纯css+js水平时间轴

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

亚马逊更新自动定价文件管理SKU功能:https://www.ikjzd.com/articles/113751
亚马逊1月1日起对美国四个州订单征税:https://www.ikjzd.com/articles/113752
一周亚马逊运营QA集锦0103:https://www.ikjzd.com/articles/113753
亚马逊1月1日起对美国四个州订单征税:https://www.ikjzd.com/articles/113754
eBay上线SpeedFreight海外仓头程服务 首月开展促销活动:https://www.ikjzd.com/articles/113755
Shopee公布1月关键词广告激励计划:https://www.ikjzd.com/articles/113756
洛阳市涧西区有啥好玩的地方 洛阳涧西区附近景点:https://www.vstour.cn/a/408256.html
九月初新疆旅游服装搭配(新疆游玩必备衣服清单):https://www.vstour.cn/a/408257.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流