--- a/demo-bootstrap.html Sun May 05 22:15:37 2013 +0900
+++ b/demo-bootstrap.html Thu May 09 00:42:25 2013 +0900
widgetClass: 'lensy-widget inline well well-small',
itemActiveClass: 'thumbnail',
- itemFn: function(value) {
- var colorbox = $('<div>').css({width: '64px', height: '64px', background: value});
+ itemFn: function(value, text) {
+ var colorbox = $('<div>').css({width: '64px', height: '64px', background: text});
--- a/demo-foundation4.html Sun May 05 22:15:37 2013 +0900
+++ b/demo-foundation4.html Thu May 09 00:42:25 2013 +0900
widgetClass: 'lensy-widget inline-list',
closeButtonClass: 'button',
- itemFn: function(value) {
- var colorbox = $('<div>').css({width: '64px', height: '64px', background: value});
+ itemFn: function(value, text) {
+ var colorbox = $('<div>').css({width: '64px', height: '64px', background: text});
--- a/demo.html Sun May 05 22:15:37 2013 +0900
+++ b/demo.html Thu May 09 00:42:25 2013 +0900
- itemFn: function(value) {
- var colorbox = $('<div>').css({width: '64px', height: '64px', background: value});
+ itemFn: function(value, text) {
+ var colorbox = $('<div>').css({width: '64px', height: '64px', background: text});
- widgetItemFn: function(value) {
+ widgetItemFn: function(value, text) {
// If you don't define this function,
// itemFn will be used for widget items.
- .css({background: value})
+ .css({background: text})
--- a/jquery.lensy.js Sun May 05 22:15:37 2013 +0900
+++ b/jquery.lensy.js Thu May 09 00:42:25 2013 +0900
- createItem: function(value) {
+ createItem: function($option) {
+ var value = $option.val();
+ var text = $option.text();
.addClass(this.settings.itemClass)
.attr('data-original-value', value)
- .html(this.settings.itemFn(value));
+ .attr('data-original-text', text)
+ .html(this.settings.itemFn(value, text));
- createWidgetItem: function(value) {
+ createWidgetItem: function($item) {
+ var value = $item.attr('data-original-value');
+ var text = $item.attr('data-original-text');
.addClass(this.settings.itemClass)
- .html((this.settings.widgetItemFn || this.settings.itemFn)(value));
+ .html((this.settings.widgetItemFn || this.settings.itemFn)(value, text));
$item.addClass(self.settings.itemActiveClass);
- var $widgetItem = self.createWidgetItem(value);
+ var $widgetItem = self.createWidgetItem($item);
self.$widget.append($widgetItem);
// $container is populated with $items
this.$select.find('option').each(function() {
- var $item = self.createItem($option.val());
+ var $item = self.createItem($option);
$item.on('click', itemSelected);
self.$container.append($item);