Skip to content

Commit d0ae054

Browse files
committed
Demo for invisible input values
1 parent 5cfdd6b commit d0ae054

1 file changed

Lines changed: 24 additions & 13 deletions

File tree

demo/index.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,41 @@ $(function(){
6767
var _$UI = this.$UI, // this is the instance; this.$UI is the colorPicker DOMElement
6868
position = $elm.offset(), // $elm is the current trigger / element that opened the colorPicker
6969
$window = $(window),
70-
gap = this.color.options.gap; // this.color.options stores all options
70+
gap = this.color.options.gap; // this.color.options stores all options
7171

7272
// _$UI.appendTo('#content-wrapper'); // demonstration only
73+
74+
// demonstrates not showing numbers in input field (part 1)
75+
// $(this.$oldElm).css({'color': 'transparent'});
76+
// this.$oldElm = $elm;
77+
// $elm.css({'color': ''});
7378

7479
return { // this demo is a copy of the internal usage (to show how it works);
7580
'left': (_$UI._left = position.left) -
76-
((_$UI._left += _$UI._width -
77-
($window.scrollLeft() + $window.width())) + gap > 0 ?
78-
_$UI._left + gap : 0),
79-
'top': (_$UI._top = position.top + $elm.outerHeight()) -
80-
((_$UI._top += _$UI._height -
81-
($window.scrollTop() + $window.height())) + gap > 0 ?
82-
_$UI._top + gap : 0)
83-
}
81+
((_$UI._left += _$UI._width -
82+
($window.scrollLeft() + $window.width())) + gap > 0 ?
83+
_$UI._left + gap : 0),
84+
'top': (_$UI._top = position.top + $elm.outerHeight()) -
85+
((_$UI._top += _$UI._height -
86+
($window.scrollTop() + $window.height())) + gap > 0 ?
87+
_$UI._top + gap : 0)
88+
}
8489
},
8590
renderCallback: function($elm, toggled) {
8691
var colors = this.color.colors; // the whole color object
8792
var rgb = colors.RND.rgb; // the RGB color in 0-255
8893

8994
// the following 6 lines are not necessary if you don't have the trigger icons with the arrows...
9095
// if (toggled === true) { // just showing (only on show)
91-
// $('.trigger').removeClass('active'); // turns arrow of color triggers
92-
// $elm.closest('.trigger').addClass('active');
96+
// $('.trigger').removeClass('active'); // turns arrow of color triggers
97+
// $elm.closest('.trigger').addClass('active');
9398
// } else if (toggled === false) { // just hiding (only on hide)
94-
// $elm.closest('.trigger').removeClass('active');
99+
// $elm.closest('.trigger').removeClass('active');
100+
// }
101+
102+
// demonstrates not showing numbers in input field (part 2)
103+
// if (toggled === false) {
104+
// $elm.css({'color': 'transparent'});
95105
// }
96106

97107
if (toggled === true) { // on show colorPicker
@@ -111,6 +121,7 @@ $(function(){
111121
};
112122

113123
window.myColorPicker =
114-
$('.color').colorPicker(options);
124+
$('.color').colorPicker(options)
125+
// .css({'color': 'transparent'}); // demonstrates not showing numbers in input field (part 3)
115126
$('.trigger').colorPicker(options);
116127
});

0 commit comments

Comments
 (0)