让slug输入框随输入扩展

This commit is contained in:
joyqi
2013-10-15 16:56:23 +08:00
parent e545168101
commit ce0d0d1dc0
3 changed files with 35 additions and 15 deletions
+16
View File
@@ -77,6 +77,22 @@ $(document).ready(function() {
t.width($('.token-input-list').outerWidth() - offset);
});
var slug = $('#slug'), sw = slug.width();
if (slug.val().length > 0) {
slug.css('width', 'auto').attr('size', slug.val().length);
}
slug.bind('input propertychange', function () {
var t = $(this), l = t.val().length;
if (l > 0) {
t.css('width', 'auto').attr('size', l);
} else {
t.css('width', sw).removeAttr('size');
}
}).width();
// 高级选项控制
$('#advance-panel-btn').click(function() {
$('#advance-panel').toggle();