| 1 |
<!doctype html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>jQuery MiniColors</title> |
| 5 |
<meta charset="utf-8"> |
| 6 |
|
| 7 |
<!-- jQuery --> |
| 8 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> |
| 9 |
|
| 10 |
<!-- MiniColors --> |
| 11 |
<script src="jquery.minicolors.js"></script> |
| 12 |
<link rel="stylesheet" href="jquery.minicolors.css"> |
| 13 |
|
| 14 |
<style> |
| 15 |
body { |
| 16 |
font: 16px sans-serif; |
| 17 |
line-height: 1.8; |
| 18 |
padding: 0 40px; |
| 19 |
margin-bottom: 200px; |
| 20 |
} |
| 21 |
a { |
| 22 |
color: #08c; |
| 23 |
text-decoration: none; |
| 24 |
} |
| 25 |
a:hover { |
| 26 |
text-decoration: underline; |
| 27 |
} |
| 28 |
.form-group { |
| 29 |
margin: 20px 0; |
| 30 |
} |
| 31 |
label { |
| 32 |
color: #888; |
| 33 |
} |
| 34 |
</style> |
| 35 |
|
| 36 |
<script> |
| 37 |
$(document).ready( function() { |
| 38 |
|
| 39 |
$('.demo').each( function() { |
| 40 |
// |
| 41 |
// Dear reader, it's actually very easy to initialize MiniColors. For example: |
| 42 |
// |
| 43 |
// $(selector).minicolors(); |
| 44 |
// |
| 45 |
// The way I've done it below is just for the demo, so don't get confused |
| 46 |
// by it. Also, data- attributes aren't supported at this time. Again, |
| 47 |
// they're only used for the purposes of this demo. |
| 48 |
// |
| 49 |
$(this).minicolors({ |
| 50 |
control: $(this).attr('data-control') || 'hue', |
| 51 |
defaultValue: $(this).attr('data-defaultValue') || '', |
| 52 |
format: $(this).attr('data-format') || 'hex', |
| 53 |
keywords: $(this).attr('data-keywords') || '', |
| 54 |
inline: $(this).attr('data-inline') === 'true', |
| 55 |
letterCase: $(this).attr('data-letterCase') || 'lowercase', |
| 56 |
opacity: $(this).attr('data-opacity'), |
| 57 |
position: $(this).attr('data-position') || 'bottom', |
| 58 |
swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [], |
| 59 |
change: function(hex, opacity) { |
| 60 |
var log; |
| 61 |
try { |
| 62 |
log = hex ? hex : 'transparent'; |
| 63 |
if( opacity ) log += ', ' + opacity; |
| 64 |
console.log(log); |
| 65 |
} catch(e) {} |
| 66 |
}, |
| 67 |
theme: 'default' |
| 68 |
}); |
| 69 |
|
| 70 |
}); |
| 71 |
|
| 72 |
}); |
| 73 |
</script> |
| 74 |
</head> |
| 75 |
<body> |
| 76 |
|
| 77 |
<h1>MiniColors Demo (without Bootstrap)</h1> |
| 78 |
<p> |
| 79 |
<a href="index.html">« Back to the Bootstrap demo</a> |
| 80 |
</p> |
| 81 |
<p> |
| 82 |
<a onclick="$(body).attr('dir')=='rtl'?$(body).removeAttr('dir'):$(body).attr('dir', 'rtl')">Toggle LTR/RTL</a> |
| 83 |
</p> |
| 84 |
<!-- Control Types --> |
| 85 |
<h3>Control Types</h3> |
| 86 |
<div class="form-group"> |
| 87 |
<label for="hue-demo">Hue (default)</label> |
| 88 |
<input type="text" id="hue-demo" class="demo" data-control="hue" value="#ff6161"> |
| 89 |
</div> |
| 90 |
<div class="form-group"> |
| 91 |
<label for="saturation-demo">Saturation</label> |
| 92 |
<input type="text" id="saturation-demo" class="demo" data-control="saturation" value="#0088cc"> |
| 93 |
</div> |
| 94 |
<div class="form-group"> |
| 95 |
<label for="brightness-demo">Brightness</label> |
| 96 |
<input type="text" id="brightness-demo" class="demo" data-control="brightness" value="#00ffff"> |
| 97 |
</div> |
| 98 |
<div class="form-group"> |
| 99 |
<label for="wheel-demo">Wheel</label> |
| 100 |
<input type="text" id="wheel-demo" class="demo" data-control="wheel" value="#ff99ee"> |
| 101 |
</div> |
| 102 |
|
| 103 |
<!-- Input modes --> |
| 104 |
<h3>Input Modes</h3> |
| 105 |
<div class="form-group"> |
| 106 |
<label for="text-field">Text field</label> |
| 107 |
<br> |
| 108 |
<input type="text" id="text-field" class="demo" value="#70c24a"> |
| 109 |
</div> |
| 110 |
<div class="form-group"> |
| 111 |
<label for="hidden-input">Hidden Input</label> |
| 112 |
<br> |
| 113 |
<input type="hidden" id="hidden-input" class="demo" value="#db913d"> |
| 114 |
</div> |
| 115 |
<div class="form-group"> |
| 116 |
<label for="inline">Inline</label> |
| 117 |
<br> |
| 118 |
<input type="text" id="inline" class="demo" data-inline="true" value="#4fc8db"> |
| 119 |
</div> |
| 120 |
|
| 121 |
<!-- Positions --> |
| 122 |
<h3>Positions</h3> |
| 123 |
<div class="form-group"> |
| 124 |
<label for="position-bottom-left">bottom left (default)</label> |
| 125 |
<input type="text" id="position-bottom-left" class="demo" data-position="bottom left" value="#0088cc"> |
| 126 |
</div> |
| 127 |
<div class="form-group"> |
| 128 |
<label for="position-top-left">top left</label> |
| 129 |
<input type="text" id="position-top-left" class="demo" data-position="top left" value="#0088cc"> |
| 130 |
</div> |
| 131 |
<div class="form-group"> |
| 132 |
<label for="position-bottom-right">bottom right</label> |
| 133 |
<input type="text" id="position-bottom-right" class="demo" data-position="bottom right" value="#0088cc"> |
| 134 |
</div> |
| 135 |
<div class="form-group"> |
| 136 |
<label for="position-top-right">top right</label> |
| 137 |
<input type="text" id="position-top-right" class="demo" data-position="top right" value="#0088cc"> |
| 138 |
</div> |
| 139 |
|
| 140 |
<!-- RGB(A) --> |
| 141 |
<h3>RGB(A)</h3> |
| 142 |
<div class="form-group"> |
| 143 |
<label for="rgb">rgb</label> |
| 144 |
<br> |
| 145 |
<input type="text" id="rgb" class="demo" data-format="rgb" value="rgb(33, 147, 58)"> |
| 146 |
</div> |
| 147 |
<div class="form-group"> |
| 148 |
<label for="rgba">rgb(a)</label> |
| 149 |
<br> |
| 150 |
<input type="text" id="rgba" class="demo" data-format="rgb" data-opacity=".5" value="rgba(52, 64, 158, 0.5)"> |
| 151 |
</div> |
| 152 |
|
| 153 |
<!-- and more --> |
| 154 |
<h3>…and more!</h3> |
| 155 |
<div class="form-group"> |
| 156 |
<label for="opacity">Opacity</label> |
| 157 |
<br> |
| 158 |
<input type="text" id="opacity" class="demo" data-opacity=".5" value="#766fa8"> |
| 159 |
</div> |
| 160 |
<div class="form-group"> |
| 161 |
<label for="keywords">Keywords</label> |
| 162 |
<br> |
| 163 |
<input type="text" id="keywords" class="demo" data-keywords="transparent, inherit, initial" value="transparent"> |
| 164 |
</div> |
| 165 |
<div class="form-group"> |
| 166 |
<label for="default-value">Default Value</label> |
| 167 |
<br> |
| 168 |
<input type="text" id="default-value" class="demo" data-defaultValue="#ff6600"> |
| 169 |
</div> |
| 170 |
<div class="form-group"> |
| 171 |
<label for="letter-case">Letter Case</label> |
| 172 |
<br> |
| 173 |
<input type="text" id="letter-case" class="demo" data-letterCase="uppercase"> |
| 174 |
</div> |
| 175 |
<div class="form-group"> |
| 176 |
<label for="letter-case">Swatches</label> |
| 177 |
<br> |
| 178 |
<input type="text" id="swatches" class="demo" data-swatches="#ef9a9a|#90caf9|#a5d6a7|#fff59d|#ffcc80|#bcaaa4|#eeeeee|#f44336|#2196f3|#4caf50|#ffeb3b|#ff9800|#795548|#9e9e9e" value="#f00"> |
| 179 |
</div> |
| 180 |
<div class="form-group"> |
| 181 |
<label for="letter-case">Swatches and opacity</label> |
| 182 |
<br> |
| 183 |
<input type="text" id="swatches-opacity" class="demo" data-format="rgb" data-opacity="1" data-swatches="#fff|#000|#f00|#0f0|#00f|#ff0|rgba(0,0,255,0.5)" value="#f00"> |
| 184 |
</div> |
| 185 |
|
| 186 |
</body> |
| 187 |
</html> |