forked from 0x2620/oxjs
first demo of auto-resizing textarea
This commit is contained in:
parent
67c154547c
commit
7f904cda1f
5 changed files with 175 additions and 50 deletions
|
|
@ -232,13 +232,13 @@ Ox.Input = function(options, self) {
|
|||
[self.colors[2], self.colors[2], self.colors[2]].join(', ') + '))'
|
||||
});
|
||||
self.$input.css({
|
||||
background: '-webkit-gradient(linear, left top, left bottom, from(rgb(' +
|
||||
[self.colors[0], self.colors[0], self.colors[0]].join(', ') + ')), color-stop(' +
|
||||
self.colorstops[0] + ', ' + 'rgb(' +
|
||||
[self.colors[1], self.colors[1], self.colors[1]].join(', ') + ')), color-stop( ' +
|
||||
self.colorstops[1] + ', ' + 'rgb(' +
|
||||
[self.colors[1], self.colors[1], self.colors[1]].join(', ') + ')), to(rgb(' +
|
||||
[self.colors[2], self.colors[2], self.colors[2]].join(', ') + ')))'
|
||||
background: '-webkit-linear-gradient(top, rgb(' +
|
||||
[self.colors[0], self.colors[0], self.colors[0]].join(', ') + '), rgb(' +
|
||||
[self.colors[1], self.colors[1], self.colors[1]].join(', ') + ') ' +
|
||||
Math.round(self.colorstops[0] * 100) + '%, rgb(' +
|
||||
[self.colors[1], self.colors[1], self.colors[1]].join(', ') + ') ' +
|
||||
Math.round(self.colorstops[1] * 100) + '%, rgb(' +
|
||||
[self.colors[2], self.colors[2], self.colors[2]].join(', ') + '))'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -625,7 +625,7 @@ Ox.Input = function(options, self) {
|
|||
hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) &&
|
||||
oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length;
|
||||
//Ox.print('keypress', event.keyCode)
|
||||
if (event.keyCode != 9 && event.keyCode != 13 && event.keyCode != 27) { // fixme: can't 13 and 27 return false?
|
||||
if (event.keyCode != 9 && (self.options.type == 'textarea' || event.keyCode != 13) && event.keyCode != 27) { // fixme: can't 13 and 27 return false?
|
||||
setTimeout(function() { // wait for val to be set
|
||||
var value = self.$input.val();
|
||||
if (self.options.autocompleteReplaceCorrect && hasDeletedSelectedEnd) {
|
||||
|
|
@ -723,6 +723,13 @@ Ox.Input = function(options, self) {
|
|||
self.$input.attr({
|
||||
disabled: value ? 'disabled' : ''
|
||||
});
|
||||
} else if (key == 'height') {
|
||||
that.css({
|
||||
height: value + 'px'
|
||||
});
|
||||
self.$input.css({
|
||||
height: value + 'px'
|
||||
});
|
||||
} else if (key == 'placeholder') {
|
||||
setPlaceholder();
|
||||
} else if (key == 'value') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue