bootstrap.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Zebra_DatePicker examples</title>
  6. <link rel="stylesheet" href="public/css/reset.css" type="text/css">
  7. <link rel="stylesheet" href="../public/css/bootstrap.css" type="text/css">
  8. <link rel="stylesheet" href="public/css/style.css" type="text/css">
  9. <link type="text/css" rel="stylesheet" href="libraries/syntaxhighlighter/public/css/shCoreDefault.css">
  10. <script type="text/javascript" src="libraries/syntaxhighlighter/public/javascript/XRegExp.js"></script>
  11. <script type="text/javascript" src="libraries/syntaxhighlighter/public/javascript/shCore.js"></script>
  12. <script type="text/javascript" src="libraries/syntaxhighlighter/public/javascript/shLegacy.js"></script>
  13. <script type="text/javascript" src="libraries/syntaxhighlighter/public/javascript/shBrushJScript.js"></script>
  14. <script type="text/javascript" src="libraries/syntaxhighlighter/public/javascript/shBrushXML.js"></script>
  15. <script type="text/javascript">
  16. SyntaxHighlighter.defaults['toolbar'] = false;
  17. SyntaxHighlighter.all();
  18. </script>
  19. </head>
  20. <body>
  21. <div class="main-wrapper">
  22. <h3>Zebra_DatePicker Demos (using the "Bootstrap" theme)</h3>
  23. <p>Click <a href="alternate.html">here</a> to use the "Metallic" theme or <a href="index.html">here</a> to use the default theme.</p><br><br>
  24. <strong>1.</strong> A date picker with defaults settings.
  25. <pre class="brush:js">
  26. $('#datepicker-example1').Zebra_DatePicker();
  27. </pre>
  28. <form action="javascript:void(0)" method="post">
  29. <div>
  30. <input id="datepicker-example1" type="text" data-zdp_direction="1">
  31. </div>
  32. </form>
  33. <p>&nbsp;</p>
  34. <strong>2.</strong> Dates can be selected only in the future, starting one day in the future.
  35. <pre class="brush:js">
  36. $('#datepicker-example2').Zebra_DatePicker({
  37. direction: 1 // boolean true would've made the date picker future only
  38. // but starting from today, rather than tomorrow
  39. });
  40. </pre>
  41. <form action="javascript:void(0)" method="post">
  42. <div><input id="datepicker-example2" type="text"></div>
  43. </form>
  44. <p>&nbsp;</p>
  45. <p><strong>3.</strong> Dates can be selected only in the future, starting today. Also, Saturday and Sundays are always disabled.</p>
  46. <pre class="brush:js">
  47. $('#datepicker-example3').Zebra_DatePicker({
  48. direction: true,
  49. disabled_dates: ['* * * 0,6'] // all days, all monts, all years as long
  50. // as the weekday is 0 or 6 (Sunday or Saturday)
  51. });
  52. </pre>
  53. <form action="javascript:void(0)" method="post">
  54. <div><input id="datepicker-example3" type="text"></div>
  55. </form>
  56. <p>&nbsp;</p>
  57. <p><strong>4.</strong> The selectable dates are in the interval starting tomorrow and ending 10 days from tomorrow.</p>
  58. <pre class="brush:js">
  59. $('#datepicker-example4').Zebra_DatePicker({
  60. direction: [1, 10]
  61. });
  62. </pre>
  63. <form action="javascript:void(0)" method="post">
  64. <div><input id="datepicker-example4" type="text"></div>
  65. </form>
  66. <p>&nbsp;</p>
  67. <p><strong>5.</strong> Dates can be selected between 2 specific dates</p>
  68. <pre class="brush:js">
  69. $('#datepicker-example5').Zebra_DatePicker({
  70. // remember that the way you write down dates
  71. // depends on the value of the "format" property!
  72. direction: ['2012-08-01', '2012-08-12']
  73. });
  74. </pre>
  75. <form action="javascript:void(0)" method="post">
  76. <div><input id="datepicker-example5" type="text"></div>
  77. </form>
  78. <p>&nbsp;</p>
  79. <p><strong>6.</strong> Dates can be selected in the future, starting with a specific date</p>
  80. <pre class="brush:js">
  81. $('#datepicker-example6').Zebra_DatePicker({
  82. // remember that the way you write down dates
  83. // depends on the value of the "format" property!
  84. direction: ['2012-08-01', false]
  85. });
  86. </pre>
  87. <form action="javascript:void(0)" method="post">
  88. <div><input id="datepicker-example6" type="text"></div>
  89. </form>
  90. <p>&nbsp;</p>
  91. <p><strong>7.</strong> The second date picker's starting date is the value of the first date picker + 1</p>
  92. <pre class="brush:js">
  93. $('#datepicker-example7-start').Zebra_DatePicker({
  94. direction: true,
  95. pair: $('#datepicker-example7-end')
  96. });
  97. $('#datepicker-example7-end').Zebra_DatePicker({
  98. direction: 1
  99. });
  100. </pre>
  101. <form action="javascript:void(0)" method="post">
  102. <div>
  103. <input id="datepicker-example7-start" type="text">
  104. <input id="datepicker-example7-end" type="text">
  105. </div>
  106. </form>
  107. <p>&nbsp;</p>
  108. <p><strong>8.</strong> Set the format of the returned date:</p>
  109. <pre class="brush:js">
  110. $('#datepicker-example8').Zebra_DatePicker({
  111. format: 'M d, Y'
  112. });
  113. </pre>
  114. <form action="javascript:void(0)" method="post">
  115. <div><input id="datepicker-example8" type="text"></div>
  116. </form>
  117. <p>&nbsp;</p>
  118. <p><strong>9.</strong> Show week number</p>
  119. <pre class="brush:js">
  120. $('#datepicker-example9').Zebra_DatePicker({
  121. show_week_number: 'Wk'
  122. });
  123. </pre>
  124. <form action="javascript:void(0)" method="post">
  125. <div><input id="datepicker-example9" type="text"></div>
  126. </form>
  127. <p>&nbsp;</p>
  128. <p><strong>10.</strong> Start with the &#8220;years&#8221; view &#8211; recommended for when users need to select their birth date. Remember that you can always switch between views by clicking in the header of the date picker between the &#8220;previous&#8221; and &#8220;next&#8221; buttons!</p>
  129. <pre class="brush:js">
  130. $('#datepicker-example10').Zebra_DatePicker({
  131. view: 'years'
  132. });
  133. </pre>
  134. <form action="javascript:void(0)" method="post">
  135. <div><input id="datepicker-example10" type="text"></div>
  136. </form>
  137. <p>&nbsp;</p>
  138. <p><strong>11.</strong> Stop after month selection</p>
  139. <pre class="brush:js">
  140. $('#datepicker-example11').Zebra_DatePicker({
  141. format: 'm Y' // note that because there's no day in the format
  142. // users will not be able to select a day!
  143. });
  144. </pre>
  145. <form action="javascript:void(0)" method="post">
  146. <div><input id="datepicker-example11" type="text"></div>
  147. </form>
  148. <p>&nbsp;</p>
  149. <p><strong>12.</strong> Handle the "onChange" event. If a callback function is attached to the "onChange"
  150. event, it will be called whenever the user changes the view (days/months/years), as well as when the user
  151. navigates by clicking on the "next"/"previous" icons in any of the views. The callback function called by
  152. this event takes two arguments - the view (days/months/years) and the "active" elements (not disabled) in
  153. that view, as jQuery elements allowing for easy customization and interaction with particular cells in the
  154. date picker's view:</p>
  155. <pre class="brush:js">
  156. $('#datepicker-example12').Zebra_DatePicker({
  157. // execute a function whenever the user changes the view (days/months/years),
  158. // as well as when the user navigates by clicking on the "next"/"previous"
  159. // icons in any of the views
  160. onChange: function(view, elements) {
  161. // on the "days" view...
  162. if (view == 'days') {
  163. // iterate through the active elements in the view
  164. elements.each(function() {
  165. // to simplify searching for particular dates, each element gets a
  166. // "date" data attribute which is the form of:
  167. // - YYYY-MM-DD for elements in the "days" view
  168. // - YYYY-MM for elements in the "months" view
  169. // - YYYY for elements in the "years" view
  170. // so, because we're on a "days" view,
  171. // let's find the 24th day using a regular expression
  172. // (notice that this will apply to every 24th day
  173. // of every month of every year)
  174. if ($(this).data('date').match(/\-24$/))
  175. // and highlight it!
  176. $(this).css({
  177. background: '#C40000',
  178. color: '#FFF'
  179. });
  180. });
  181. }
  182. }
  183. });
  184. </pre>
  185. <form action="javascript:void(0)" method="post">
  186. <div><input id="datepicker-example12" type="text"></div>
  187. </form>
  188. <p>&nbsp;</p>
  189. <p><strong>13.</strong> Calendar is always visible. Set the "always_visible" property to point to a jQuery
  190. element which to contain the date picker</p>
  191. <pre class="brush:js">
  192. $('#datepicker-example13').Zebra_DatePicker({
  193. always_visible: $('#container')
  194. });
  195. </pre>
  196. <form action="javascript:void(0)" method="post">
  197. <div>
  198. <input id="datepicker-example13" type="text">
  199. <div id="container" style="margin: 10px 0 0 0; height: 250px"></div>
  200. </div>
  201. </form>
  202. <p>&nbsp;</p>
  203. <p><strong>14.</strong> Using data attributes</p>
  204. <p>Any property of the date picker can also be set via data-attributes. All you have to do is take any property
  205. described in the "Configuration" section and prefix it with "data-zdp_". One important thing to remember is that
  206. if the value of the property is an array you'll have to use <strong>double quotes</strong> inside the square
  207. brackets and therefore single quotes around the attribute - see the example below:</p>
  208. <pre class="brush:xml">
  209. &lt;input type="text" id="datepicker-example14" data-zdp_direction="1" data-zdp_disabled_dates='["* * * 0,6"]'>
  210. </pre>
  211. <pre class="brush:js">
  212. $('#datepicker-example14').Zebra_DatePicker();
  213. </pre>
  214. <form action="javascript:void(0)" method="post">
  215. <div>
  216. <input id="datepicker-example14" type="text" data-zdp_direction="1" data-zdp_disabled_dates='["* * * 0,6"]'>
  217. </div>
  218. </form>
  219. <br><br><br>
  220. </div>
  221. <script type="text/javascript" src="public/javascript/jquery-1.10.2.js"></script>
  222. <script type="text/javascript" src="../public/javascript/zebra_datepicker.js"></script>
  223. <script type="text/javascript" src="public/javascript/core.js"></script>
  224. </body>
  225. </html>