首页 > 其他 > 详细

自定义datetimepicker日期控件

时间:2016-06-07 16:37:05      阅读:490      评论:0      收藏:0      [点我收藏+]

Bootstrap v3.3.5

css

/* ======================================== ys-datetimepicker ======================================== */
.ys-datetimepicker{
    position:relative;
    width:100%;
    height:32px;
    cursor:pointer;
}

.ys-datetimepicker>input.form-control{
    width:100%;
    height:32px;
    background-color:#fff;
    border-radius: 0;
    cursor:pointer;
    border:1px solid #ccc;
    padding-left:10px;

}
.ys-datetimepicker:after{
    content:"";
    position:absolute;
    top:0;
    right:0;
    display:block;
    width:32px;
    height:32px;
    background: url(../../images/common/ys-datetime-icon.png) no-repeat center center;
    background-size:20px 20px;
    border:1px solid #ccc;
}

.datetimepicker.datetimepicker-dropdown-bottom-right.dropdown-menu .datetimepicker-minutes .minute.active,
.datetimepicker.datetimepicker-dropdown-bottom-right.dropdown-menu .datetimepicker-hours .hour.active,
.datetimepicker.datetimepicker-dropdown-bottom-right.dropdown-menu .datetimepicker-days .day.active,
.datetimepicker.datetimepicker-dropdown-bottom-right.dropdown-menu .datetimepicker-months .month.active,
.datetimepicker.datetimepicker-dropdown-bottom-right.dropdown-menu .datetimepicker-years .year.active{
    background-image:none;
    background-color:#e64e4d;
}

html

<!-- 日期控件 -->
<div class="ys-datetimepicker">
    <input size="16" class="form-control" type="text" value="2015-10-01" readonly=""/>
</div>

javascript

$(".ys-datetimepicker input").datetimepicker({
    language: "zh-CN",
    format:"yyyy-mm-dd",
    todayBtn:"linked",
    startView:2,
    minView:2,
    weekStart: 1,
    todayHighlight: 1,
    autoclose: 1,
    forceParse: 0
});

$(".ys-datetimepicker").on("click",function(e){
    e.stopPropagation();
    e.preventDefault();
    $(this).closest(".ys-datetimepicker").find("input").datetimepicker("show");
});


自定义datetimepicker日期控件

原文:http://antlove.blog.51cto.com/10057557/1786903

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!