layerdate.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>H+ 后台主题UI框架 - 日期选择器layerDate</title>
  7. <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  8. <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
  9. <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
  10. <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
  11. <link href="css/animate.css" rel="stylesheet">
  12. <link href="css/animate.css" rel="stylesheet">
  13. <link href="css/style.css?v=4.1.0" rel="stylesheet">
  14. </head>
  15. <body class="gray-bg">
  16. <div class="wrapper wrapper-content animated fadeIn">
  17. <div class="row">
  18. <div class="col-sm-12">
  19. <div class="ibox float-e-margins">
  20. <div class="ibox-title">
  21. <h5>layerDate简介</h5>
  22. <div class="ibox-tools">
  23. <a class="collapse-link">
  24. <i class="fa fa-chevron-up"></i>
  25. </a>
  26. <a class="dropdown-toggle" data-toggle="dropdown" href="tabs_panels.html#">
  27. <i class="fa fa-wrench"></i>
  28. </a>
  29. <ul class="dropdown-menu dropdown-user">
  30. <li><a href="tabs_panels.html#">选项1</a>
  31. </li>
  32. <li><a href="tabs_panels.html#">选项2</a>
  33. </li>
  34. </ul>
  35. <a class="close-link">
  36. <i class="fa fa-times"></i>
  37. </a>
  38. </div>
  39. </div>
  40. <div class="ibox-content">
  41. <p>你是时候换一款日期控件了,而layDate非常愿意和您成为工作伙伴。她致力于成为全球最用心的web日期支撑,为国内外所有从事web应用开发的同仁提供力所能及的动力。她基于原生JavaScript精心雕琢,兼容了包括IE6在内的所有主流浏览器。她具备优雅的内部代码,良好的性能体验,和完善的皮肤体系,并且完全开源,你可以任意获取开发版源代码,一扫某些传统日期控件的封闭与狭隘。layDate本着资源共享的开发者精神和对网页日历交互无穷的追求,延续了layui一贯的简单与易用。她遵循LGPL协议,您可以免费将她用于任何个人项目。</p>
  42. <p>官网:<a href="http://sentsin.com/layui/laydate/" target="_blank">http://sentsin.com/layui/laydate/</a>
  43. </p>
  44. </div>
  45. </div>
  46. <div class="row">
  47. <div class="col-sm-6">
  48. <div class="ibox float-e-margins">
  49. <div class="ibox-title">
  50. <h5>layerDate示例</h5>
  51. <div class="ibox-tools">
  52. <a class="collapse-link">
  53. <i class="fa fa-chevron-up"></i>
  54. </a>
  55. <a class="dropdown-toggle" data-toggle="dropdown" href="tabs_panels.html#">
  56. <i class="fa fa-wrench"></i>
  57. </a>
  58. <ul class="dropdown-menu dropdown-user">
  59. <li><a href="tabs_panels.html#">选项1</a>
  60. </li>
  61. <li><a href="tabs_panels.html#">选项2</a>
  62. </li>
  63. </ul>
  64. <a class="close-link">
  65. <i class="fa fa-times"></i>
  66. </a>
  67. </div>
  68. </div>
  69. <div class="ibox-content">
  70. <form class="form-horizontal m-t">
  71. <div class="form-group">
  72. <label class="col-sm-2 control-label">普通:</label>
  73. <div class="col-sm-10">
  74. <input class="form-control layer-date" placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  75. <label class="laydate-icon"></label>
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <label class="col-sm-2 control-label">外部js调用:</label>
  80. <div class="col-sm-10">
  81. <input id="hello" class="laydate-icon form-control layer-date">
  82. </div>
  83. </div>
  84. <div class="form-group">
  85. <label class="col-sm-2 control-label">图标触发日期:</label>
  86. <div class="col-sm-10">
  87. <input readonly class="form-control layer-date" id="hello1">
  88. <label class="laydate-icon inline demoicon" onclick="laydate({elem: '#hello1'});"></label>
  89. </div>
  90. </div>
  91. <div class="form-group">
  92. <label class="col-sm-2 control-label">图标触发日期:</label>
  93. <div class="col-sm-10">
  94. <input placeholder="开始日期" class="form-control layer-date" id="start">
  95. <input placeholder="结束日期" class="form-control layer-date" id="end">
  96. </div>
  97. </div>
  98. </form>
  99. <hr>
  100. <p>日期选择器时,请给input添加<code>class="form-control layer-date"</code>,否则可能出现错位的情况。</p>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="col-sm-6">
  105. <div class="ibox float-e-margins">
  106. <div class="ibox-title">
  107. <h5>layerDate API文档</h5>
  108. <div class="ibox-tools">
  109. <a class="collapse-link">
  110. <i class="fa fa-chevron-up"></i>
  111. </a>
  112. <a class="dropdown-toggle" data-toggle="dropdown" href="tabs_panels.html#">
  113. <i class="fa fa-wrench"></i>
  114. </a>
  115. <ul class="dropdown-menu dropdown-user">
  116. <li><a href="tabs_panels.html#">选项1</a>
  117. </li>
  118. <li><a href="tabs_panels.html#">选项2</a>
  119. </li>
  120. </ul>
  121. <a class="close-link">
  122. <i class="fa fa-times"></i>
  123. </a>
  124. </div>
  125. </div>
  126. <div class="ibox-content">
  127. <div class="panel-body">
  128. <div class="panel-group" id="accordion">
  129. <div class="panel panel-default">
  130. <div class="panel-heading">
  131. <h5 class="panel-title">
  132. <span class="label label-info">1</span> <a data-toggle="collapse" data-parent="#accordion" href="tabs_panels.html#collapseOne">核心方法:<code>aydate(options)</code></a>
  133. </h5>
  134. </div>
  135. <div id="collapseOne" class="panel-collapse collapse in">
  136. <div class="panel-body">
  137. <p>options是一个对象,它包含了以下key: '默认值'</p>
  138. <pre>
  139. elem: '#id', //需显示日期的元素选择器
  140. event: 'click', //触发事件
  141. format: 'YYYY-MM-DD hh:mm:ss', //日期格式
  142. istime: false, //是否开启时间选择
  143. isclear: true, //是否显示清空
  144. istoday: true, //是否显示今天
  145. issure: true, 是否显示确认
  146. festival: true //是否显示节日
  147. min: '1900-01-01 00:00:00', //最小日期
  148. max: '2099-12-31 23:59:59', //最大日期
  149. start: '2014-6-15 23:00:00', //开始日期
  150. fixed: false, //是否固定在可视区域
  151. zIndex: 99999999, //css z-index
  152. choose: function(dates){ //选择好日期的回调
  153. }</pre>
  154. </div>
  155. </div>
  156. </div>
  157. <div class="panel panel-default">
  158. <div class="panel-heading">
  159. <h4 class="panel-title">
  160. <span class="label label-info">2</span>
  161. <a data-toggle="collapse" data-parent="#accordion" href="tabs_panels.html#collapseTwo">其它方法/属性</a>
  162. </h4>
  163. </div>
  164. <div id="collapseTwo" class="panel-collapse collapse">
  165. <div class="panel-body">
  166. <pre>
  167. laydate.v //获取laydate版本号
  168. laydate.skin(lib); //加载皮肤,参数lib为皮肤名
  169. /*
  170. layer.now支持多类型参数。timestamp可以是前后若干天,也可以是一个时间戳。format为日期格式,为空时则采用默认的“-”分割。
  171. 如laydate.now(-2)将返回前天,laydate.now(3999634079890)将返回2096-09-28
  172. */
  173. layer.now(timestamp, format); //该方法提供了丰富的功能,推荐灵活使用。
  174. laydate.reset(); //重设日历控件坐标,一般用于页面dom结构改变时。无参</pre>
  175. </div>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. <!-- 全局js -->
  188. <script src="js/jquery.min.js?v=2.1.4"></script>
  189. <script src="js/bootstrap.min.js?v=3.3.7"></script>
  190. <!-- 自定义js -->
  191. <script src="js/content.js?v=1.0.0"></script>
  192. <!-- layerDate plugin javascript -->
  193. <script src="js/plugins/layer/laydate/laydate.js"></script>
  194. <script>
  195. //外部js调用
  196. laydate({
  197. elem: '#hello', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
  198. event: 'focus' //响应事件。如果没有传入event,则按照默认的click
  199. });
  200. //日期范围限制
  201. var start = {
  202. elem: '#start',
  203. format: 'YYYY/MM/DD hh:mm:ss',
  204. min: laydate.now(), //设定最小日期为当前日期
  205. max: '2099-06-16 23:59:59', //最大日期
  206. istime: true,
  207. istoday: false,
  208. choose: function (datas) {
  209. end.min = datas; //开始日选好后,重置结束日的最小日期
  210. end.start = datas //将结束日的初始值设定为开始日
  211. }
  212. };
  213. var end = {
  214. elem: '#end',
  215. format: 'YYYY/MM/DD hh:mm:ss',
  216. min: laydate.now(),
  217. max: '2099-06-16 23:59:59',
  218. istime: true,
  219. istoday: false,
  220. choose: function (datas) {
  221. start.max = datas; //结束日选好后,重置开始日的最大日期
  222. }
  223. };
  224. laydate(start);
  225. laydate(end);
  226. </script>
  227. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
  228. <!--统计代码,可删除-->
  229. </body>
  230. </html>