parent
1109eba460
commit
216c834a40
@ -1,19 +1,40 @@
|
|||||||
app.directive('inputAuto',function(){
|
//app.directive('inputAuto',function(){
|
||||||
return{
|
// return{
|
||||||
restrict: 'A',
|
// restrict: 'A',
|
||||||
scope: {},
|
// scope: {},
|
||||||
link: function(scope, element){
|
// link: function(scope, element){
|
||||||
var copyContainer = element.parent().children().children().eq(0);
|
// var copyContainer = element.parent().children().children().eq(0);
|
||||||
var sendButton = element.next();
|
// var sendButton = element.next();
|
||||||
element.on('input',function(){
|
// element.on('input',function(){
|
||||||
//console.log(sendButton);
|
// //console.log(sendButton);
|
||||||
copyContainer.html(element[0].value);
|
// copyContainer.html(element[0].value);
|
||||||
var textHeight = copyContainer[0].scrollHeight-10;
|
// var textHeight = copyContainer[0].scrollHeight-10;
|
||||||
element.css('height', textHeight + 'px');
|
// element.css('height', textHeight + 'px');
|
||||||
});
|
// });
|
||||||
sendButton.on('click',function(){
|
// sendButton.on('click',function(){
|
||||||
element.css('height','18px');
|
// element.css('height','18px');
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
//});
|
||||||
|
|
||||||
|
app.directive('inputAuto',["$timeout",function(timer){
|
||||||
|
return{
|
||||||
|
restrict: 'A',
|
||||||
|
scope: {},
|
||||||
|
link: function(scope, element){
|
||||||
|
timer(function(){
|
||||||
|
$(".post-reply-input").bind("input",function(){
|
||||||
|
var copyInput = $(this).prev().children();
|
||||||
|
var sendButton = $(this).next();
|
||||||
|
copyInput.html($(this).val());
|
||||||
|
var textHeight = copyInput[0].scrollHeight-10;
|
||||||
|
$(this).css("height",textHeight + "px");
|
||||||
|
sendButton.click(function(){
|
||||||
|
$(this).prev().css("height","18px");
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
Loading…
Reference in new issue