without-bootstrap.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>jQuery MiniColors</title>
  5. <meta charset="utf-8">
  6. <!-- jQuery -->
  7. <script src="jquery.min.js"></script>
  8. <!-- MiniColors -->
  9. <script src="jquery.minicolors.js"></script>
  10. <link rel="stylesheet" href="jquery.minicolors.css">
  11. <style>
  12. body {
  13. font: 16px sans-serif;
  14. line-height: 1.8;
  15. padding: 0 40px;
  16. margin-bottom: 200px;
  17. }
  18. a {
  19. color: #08c;
  20. text-decoration: none;
  21. }
  22. a:hover {
  23. text-decoration: underline;
  24. }
  25. .form-group {
  26. margin: 20px 0;
  27. }
  28. label {
  29. color: #888;
  30. }
  31. </style>
  32. <script>
  33. $(document).ready( function() {
  34. $('.demo').each( function() {
  35. //
  36. // Dear reader, it's actually very easy to initialize MiniColors. For example:
  37. //
  38. // $(selector).minicolors();
  39. //
  40. // The way I've done it below is just for the demo, so don't get confused
  41. // by it. Also, data- attributes aren't supported at this time. Again,
  42. // they're only used for the purposes of this demo.
  43. //
  44. $(this).minicolors({
  45. control: $(this).attr('data-control') || 'hue',
  46. defaultValue: $(this).attr('data-defaultValue') || '',
  47. inline: $(this).attr('data-inline') === 'true',
  48. letterCase: $(this).attr('data-letterCase') || 'lowercase',
  49. opacity: $(this).attr('data-opacity'),
  50. position: $(this).attr('data-position') || 'bottom left',
  51. change: function(hex, opacity) {
  52. var log;
  53. try {
  54. log = hex ? hex : 'transparent';
  55. if( opacity ) log += ', ' + opacity;
  56. console.log(log);
  57. } catch(e) {}
  58. },
  59. theme: 'default'
  60. });
  61. });
  62. });
  63. </script>
  64. </head>
  65. <body>
  66. <div class="form-group">
  67. <input type="text" id="text-field" class="demo" value="#70c24a">
  68. </div>
  69. </body>
  70. </html>