mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Improved textarea
This commit is contained in:
parent
836127d08f
commit
b2924cb14e
@ -16,6 +16,9 @@ var textArea2 = function(infos){
|
||||
*
|
||||
* @param {Object} infos Informations about the textarea to enable
|
||||
* @info {HTMLElement} element The element to make modern
|
||||
* @info {Integer} minHeight The minimal height for the textarea
|
||||
* @info {Integer} maxHeight The maximal height for the textarea
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
textArea2.prototype.init = function(infos){
|
||||
|
||||
@ -24,10 +27,21 @@ textArea2.prototype.init = function(infos){
|
||||
|
||||
//Adapt textarea style
|
||||
this.element.style.overflow = "hidden";
|
||||
this.element.style.resize = "none";
|
||||
|
||||
//Check for minimal and maximal height
|
||||
if(infos.minHeight){
|
||||
this.element.style.height = infos.minHeight;
|
||||
this.element.style.minHeight = infos.minHeight;
|
||||
}
|
||||
if(infos.maxHeight)
|
||||
this.element.style.maxHeight = infos.maxHeight;
|
||||
|
||||
//Initializate textarea auto-size
|
||||
$(this.element).textareaAutoSize();
|
||||
|
||||
//Success
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,9 @@ ComunicWeb.pages.home.home = {
|
||||
//Initializate textarea
|
||||
var textarea2 = new ComunicWeb.components.textarea();
|
||||
textarea2.init({
|
||||
element: textarea
|
||||
element: textarea,
|
||||
minHeight: "32px",
|
||||
maxHeight: "70px",
|
||||
});
|
||||
|
||||
console.log(textarea2);
|
||||
|
Loading…
Reference in New Issue
Block a user