diff --git a/zheng-ui/src/js/common.js b/zheng-ui/src/js/common.js index ce44790c..fc73d11a 100644 --- a/zheng-ui/src/js/common.js +++ b/zheng-ui/src/js/common.js @@ -7,6 +7,14 @@ $(function() { height: getHeight() }); }); + // 设置input特效 + $(document).on('focus', 'input[type="text"]', function() { + $(this).parent().find('label').addClass('active'); + }).on('blur', 'input[type="text"]', function() { + if ($(this).val() == '') { + $(this).parent().find('label').removeClass('active'); + } + }); }); // 动态高度 function getHeight() { @@ -19,4 +27,12 @@ function detailFormatter(index, row) { html.push('

' + key + ': ' + value + '

'); }); return html.join(''); +} +// 初始化input特效 +function initMaterialInput() { + $('form input[type="text"]').each(function () { + if ($(this).val() != '') { + $(this).parent().find('label').addClass('active'); + } + }); } \ No newline at end of file