行程日历组件:选择开始和结束日期+滑动选择时间

前一篇文章刚给大家分享了滑动组件(http://blog.youkuaiyun.com/sq_zhuyi/article/details/79103683),本篇文章就正好利用到这个滑动组件,在日历控件中实现选择时间的模块。同样,为了便于入题,我们先看效果图:


这是一个在租车项目中选择取车时间和还车时间的日历,其实同样的场景被用于很多旅游项目,用来选择出发、返程时间。

上代码,CSS模块:

.acal {
    position: absolute;
    left: 0;
    right: 0;
    top: 44px;
    z-index: 100;
}

.acal .head {
    position: fixed;
    left: 0;
    right: 0;
    top: 44px;
    z-index: 12;
    height: 44px;
    padding: 0 25px;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
    text-align: center;
}
.acal .head .dt {
    line-height: 44px;
    font-size: 18px;
}
.acal .head .day {
    width: 3.5em;
    line-height: 26px;
    border: 1px solid #f00;
    border-radius: 8px;
    margin-top: 8px;
}

.acal .week {
    position: fixed;
    left: 0;
    right: 0;
    top: 88px;
    z-index: 11;
    line-height: 32px;
    text-align: center;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.acal .week>i {
    width: 14.28%;
}

.acal .calbody {
    padding: 80px 0 200px 0;
    background-color: #f9f9f9;
}
.acal .month {
    position: relative;
}
.acal .month>h2 {
    text-align: center;
    line-height: 295px;
    font-size: 80px;
    color: #dedede;
    font-weight: normal;
}
.acal .month .days {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}
.acal .month .days>i {
    float: left;
    width: 59px;
    height: 39px;
    margin: 10px 0;
    text-align: center;
    font-size: 20px;
    position: relative;
}
.acal .month .days em {
    width: 39px;
    line-height: 39px;
    border-radius: 50%;
    position: absolute;
    left: 10px;
    top: 0;
    z-index: 2;
}
.acal .month .days>i.disabled {
    color: #999;
}
.acal .month .days>i.hover {
    color: #fff;
}
.acal .month .days>i.hover>em {
    background-color: #f00;
}
.acal .month .days>i.hover::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    background-color: #FFD2CF;
}
.acal .month .days>i.start::before {
    left: 30px;
    right: 0;
}
.acal .month .days>i.end::before {
    left: 0;
    right: 30px;
}
.acal .m
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值