jquery-amd.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
  6. <title>Pikaday - jQuery + AMD example</title>
  7. <meta name="author" content="Ramiro Rikkert">
  8. <link rel="stylesheet" href="../css/pikaday.css">
  9. <link rel="stylesheet" href="../css/site.css">
  10. </head>
  11. <body>
  12. <a href="https://github.com/dbushell/Pikaday"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
  13. <h1>Pikaday - jQuery + AMD example</h1>
  14. <p class="large">A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS.</p>
  15. <label for="datepicker">Date:</label>
  16. <br>
  17. <input type="text" id="datepicker">
  18. <h2>What is this?</h2>
  19. <p>Since version 1.0 Pikaday is a stable and battle tested date-picker. Feel free to use it however you like but please report any bugs or feature requests to the <a href="https://github.com/dbushell/Pikaday/issues">GitHub issue tracker</a>, thanks!</p>
  20. <p class="small">Copyright © 2014 <a href="http://dbushell.com/">David Bushell</a> | BSD &amp; MIT license | Example by <a href="https://github.com/rikkert">Ramiro Rikkert</a></p>
  21. <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.js"></script>
  22. <script>
  23. require.config({
  24. baseUrl: '../',
  25. // To get timely, correct error triggers in IE, force a define/shim exports check.
  26. enforceDefine: true,
  27. paths: {
  28. jquery: '//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min'
  29. }
  30. });
  31. require(['jquery', 'plugins/pikaday.jquery'], function($)
  32. {
  33. var $datepicker = $('#datepicker').pikaday({
  34. firstDay: 1,
  35. minDate: new Date(2000, 0, 1),
  36. maxDate: new Date(2020, 12, 31),
  37. yearRange: [2000,2020]
  38. });
  39. // chain a few methods for the first datepicker, jQuery style!
  40. $datepicker.pikaday('show').pikaday('nextMonth');
  41. });
  42. </script>
  43. </body>
  44. </html>