| 1 |
<!DOCTYPE html> |
| 2 |
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]--> |
| 3 |
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]--> |
| 4 |
<!--[if IE 8]><html class="no-js lt-ie9"><![endif]--> |
| 5 |
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--> |
| 6 |
<head> |
| 7 |
<meta charset="utf-8"> |
| 8 |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 9 |
<title>Selectize.js Demo</title> |
| 10 |
<meta name="description" content=""> |
| 11 |
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"> |
| 12 |
<link rel="stylesheet" href="css/normalize.css"> |
| 13 |
<link rel="stylesheet" href="css/stylesheet.css"> |
| 14 |
<!--[if IE 8]><script src="js/es5.js"></script><![endif]--> |
| 15 |
<script src="js/jquery.min.js"></script> |
| 16 |
<script src="../dist/js/standalone/selectize.js"></script> |
| 17 |
<script src="js/index.js"></script> |
| 18 |
<style type="text/css"> |
| 19 |
.selectize-control .option .title { |
| 20 |
display: block; |
| 21 |
} |
| 22 |
.selectize-control .option .url { |
| 23 |
font-size: 12px; |
| 24 |
display: block; |
| 25 |
color: #a0a0a0; |
| 26 |
} |
| 27 |
.selectize-control .item a { |
| 28 |
color: #006ef5; |
| 29 |
} |
| 30 |
.selectize-control .item.active a { |
| 31 |
color: #303030; |
| 32 |
} |
| 33 |
</style> |
| 34 |
</head> |
| 35 |
<body> |
| 36 |
<div id="wrapper"> |
| 37 |
<h1>Selectize.js</h1> |
| 38 |
<div class="demo"> |
| 39 |
<h2>Customizing Appearance</h2> |
| 40 |
<p>Render items on your own & apply unique CSS styles.</p> |
| 41 |
<div class="control-group"> |
| 42 |
<label for="select-links">Links:</label> |
| 43 |
<select id="select-links" placeholder="Pick some links..."></select> |
| 44 |
</div> |
| 45 |
<script> |
| 46 |
// <select id="select-links"></select> |
| 47 |
|
| 48 |
$('#select-links').selectize({ |
| 49 |
theme: 'links', |
| 50 |
maxItems: null, |
| 51 |
valueField: 'id', |
| 52 |
searchField: 'title', |
| 53 |
options: [ |
| 54 |
{id: 1, title: 'DIY', url: 'https://diy.org'}, |
| 55 |
{id: 2, title: 'Google', url: 'http://google.com'}, |
| 56 |
{id: 3, title: 'Yahoo', url: 'http://yahoo.com'}, |
| 57 |
], |
| 58 |
render: { |
| 59 |
option: function(data, escape) { |
| 60 |
return '<div class="option">' + |
| 61 |
'<span class="title">' + escape(data.title) + '</span>' + |
| 62 |
'<span class="url">' + escape(data.url) + '</span>' + |
| 63 |
'</div>'; |
| 64 |
}, |
| 65 |
item: function(data, escape) { |
| 66 |
return '<div class="item"><a href="' + escape(data.url) + '">' + escape(data.title) + '</a></div>'; |
| 67 |
} |
| 68 |
}, |
| 69 |
create: function(input) { |
| 70 |
return { |
| 71 |
id: 0, |
| 72 |
title: input, |
| 73 |
url: '#' |
| 74 |
}; |
| 75 |
} |
| 76 |
}); |
| 77 |
</script> |
| 78 |
<p>TODO: explain how to bind events.</p> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</body> |
| 82 |
</html> |