socialforge/public/javascripts/wechat/directives/input_auto.js

19 lines
658 B
JavaScript

app.directive('inputAuto',function(){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
var copyContainer = element.parent().children().children().eq(0);
var sendButton = element.next();
element.on('input',function(){
console.log(sendButton);
copyContainer.html(element[0].value);
var textHeight = copyContainer[0].scrollHeight;
element.css('height', textHeight + 'px');
});
sendButton.on('click',function(){
element.css('height','28px');
});
}
}
});