本文實(shí)例為大家分享了bootstrap時(shí)間插件daterangepicker的具體代碼,供大家參考,具體內(nèi)容如下
插件下載地址:https://github.com/dangrossman/bootstrap-daterangepicker
頭部引入文件:
<link href=”http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css” rel=”stylesheet”><link rel=”stylesheet” type=”text/css” media=”all” href=”daterangepicker.css” /><script type=”text/javascript” src=”http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js“></script><script type=”text/javascript” src=”http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js“></script><script type=”text/javascript” src=”moment.js“></script><script type=”text/javascript” src=”daterangepicker.js“></script>
相關(guān)配置:
$('#startDate').daterangepicker({ //綁定input元素 id="startDate" "startDate": "08/07/2015 - 08/17/2015", //默認(rèn)選擇開(kāi)始時(shí)間 "endDate": "08/17/2015", //默認(rèn)選擇結(jié)束時(shí)間 //singleDatePicker: true, //顯示單個(gè)日歷表 //"timePicker": true, //開(kāi)啟時(shí)、分 //"showWeekNumbers": true, //顯示第幾周 //"timePicker24Hour": true, //開(kāi)啟24小時(shí)制 startDate: moment().subtract(10, 'days'), //兩個(gè)時(shí)間相隔時(shí)間 "showDropdowns": true, //開(kāi)啟年月的選擇 ranges : { //快捷選擇時(shí)間 '最近1小時(shí)': [moment().subtract('hours',1), moment()], '今日': [moment(), moment()], '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')], '最近7日': [moment().subtract('days', 6), moment()], '最近30日': [moment().subtract('days', 29), moment()] }, locale : { //中文漢化 applyLabel : '確定', cancelLabel : '取消', fromLabel : '起始時(shí)間', toLabel : '結(jié)束時(shí)間', customRangeLabel : '自定義', daysOfWeek : ['日','一','二','三','四','五','六'], monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ], firstDay : 1 }, // "opens": "left", //日歷表的位置 // "drops": "up", //日歷表的位置 // "buttonClasses": "button", //日歷表"確定"按鈕類名 // "applyClass": "hover", //日歷表"確定"按鈕類名 // "cancelClass": "cancel" //日歷表"取消"按鈕類名 });以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持錯(cuò)新站長(zhǎng)站。
新聞熱點(diǎn)
疑難解答
圖片精選