输入框支持文字内容滑动

This commit is contained in:
txz 2016-05-25 14:26:49 +08:00
parent c4c0dd3c60
commit 921b01e8e3
2 changed files with 7 additions and 2 deletions

View File

@ -136,7 +136,7 @@ app.factory('common', function($http, auth, $routeParams){
url: apiUrl+ "new_comment/"+id, url: apiUrl+ "new_comment/"+id,
data: userInfo data: userInfo
}).then(function successCallback(response) { }).then(function successCallback(response) {
alert("提交成功"); //alert("提交成功");
//数据提交完成,回复按钮启用 //数据提交完成,回复按钮启用
data.disabled = false; data.disabled = false;
if(typeof cb === 'function'){ if(typeof cb === 'function'){
@ -410,11 +410,16 @@ app.directive('inputAuto',function(){
scope: {}, scope: {},
link: function(scope, element){ link: function(scope, element){
var copyContainer = element.parent().children().eq(0); var copyContainer = element.parent().children().eq(0);
var sendButton = element.parent().next();
element.on('input',function(){ element.on('input',function(){
console.log(sendButton);
copyContainer.html(element[0].value); copyContainer.html(element[0].value);
var textHeight = copyContainer[0].scrollHeight; var textHeight = copyContainer[0].scrollHeight;
element.css('height', textHeight + 'px'); element.css('height', textHeight + 'px');
}); });
sendButton.on('click',function(){
element.css('height','28px');
});
} }
} }
}); });

View File

@ -70,7 +70,7 @@ a.underline {text-decoration:underline;}
.post-reply-date, .post-reply-trigger {font-size:13px;} .post-reply-date, .post-reply-trigger {font-size:13px;}
.post-input-container {padding-right:2px;} .post-input-container {padding-right:2px;}
.copy-input {width:100%; height:28px; line-height:28px; border-radius:3px; position:absolute; left:-9999em;} .copy-input {width:100%; height:28px; line-height:28px; border-radius:3px; position:absolute; left:-9999em;}
.post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; border:1px solid #e6e6e6; outline:none; padding:0; margin:0; border-radius:3px; overflow-y:hidden; resize:none;} .post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; border:1px solid #e6e6e6; outline:none; padding:0; margin:0; border-radius:3px; overflow-y:auto; resize:none;}
.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;} .post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;}
.reply-icon {background:url(/images/wechat/wechat_icon.gif) -100px 1px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .reply-icon {background:url(/images/wechat/wechat_icon.gif) -100px 1px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
.praise-icon {background:url(/images/wechat/wechat_icon.gif) -100px -38px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .praise-icon {background:url(/images/wechat/wechat_icon.gif) -100px -38px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}