Anton Shestakov <engored@ya.ru>, Fri, 10 May 2013 20:31:49 +0900
Make default itemFn use text instead of value.
demo.html
Permissions: -rw-r--r--
<title>Lensy Demo
</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.min.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script src="jquery.lensy.js"></script> <style id="page-niceties"> -webkit-border-radius: 4px; background-color: #f5f5f5; -webkit-border-radius: 4px 0 4px 0; -moz-border-radius: 4px 0 4px 0; border-radius: 4px 0 4px 0; padding: 29px 8px 8px 8px; background-color: #f7f7f9; border: 1px solid #e1e1e8; -webkit-border-radius: 4px; content: 'Live clickable <select>'; background: rgba(0, 0, 0, 0.75); border: 1px solid transparent; -webkit-border-radius: 5px; border: 1px solid #cccccc; -webkit-border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); .lensy-widget .lensy-item { .lensy-widget .lensy-item span { border: 1px solid transparent; -webkit-border-radius: 4px; box-shadow: 0px 0px 6px 1px white; <div class="page-header"> <select multiple name="colors"> <option selected>#0e90d2
</option> <option selected>#dd514c
</option> itemFn: function(value, text) { var colorbox = $('<div>').css({width: '64px', height: '64px', background: text}); widgetItemFn: function(value, text) { // If you don't define this function, // itemFn will be used for widget items. $('select').appendTo('#live-select').show(); $('pre#css').text($('#lensy-css').text().trim().replace(/^ {6}/gm, '').replace(/}/g, '}\n')); $('pre#js').text($('#lensy-js').text().trim().replace(/^ {12}/gm, '')); <div id="live-select" class="example"></div> <pre id="css" class="prettyprint lang-css"></pre> <pre id="js" class="prettyprint lang-js"></pre> <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>