shuzheng 9 лет назад
Родитель
Сommit
371ec172d1
1 измененных файлов с 16 добавлено и 0 удалено
  1. 16 0
      zheng-ui/src/js/common.js

+ 16 - 0
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('<p><b>' + key + ':</b> ' + value + '</p>');
 	});
 	return html.join('');
+}
+// 初始化input特效
+function initMaterialInput() {
+	$('form input[type="text"]').each(function () {
+		if ($(this).val() != '') {
+			$(this).parent().find('label').addClass('active');
+		}
+	});
 }