demo前端模版添加
This commit is contained in:
40
mall-demo/src/main/resources/static/js/common.js
Normal file
40
mall-demo/src/main/resources/static/js/common.js
Normal file
@@ -0,0 +1,40 @@
|
||||
$(function() {
|
||||
// Waves初始化
|
||||
Waves.displayEffect();
|
||||
// 数据表格动态高度
|
||||
$(window).resize(function () {
|
||||
$('#table').bootstrapTable('resetView', {
|
||||
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');
|
||||
}
|
||||
});
|
||||
// select2初始化
|
||||
$('select').select2();
|
||||
});
|
||||
// 动态高度
|
||||
function getHeight() {
|
||||
return $(window).height() - 20;
|
||||
}
|
||||
// 数据表格展开内容
|
||||
function detailFormatter(index, row) {
|
||||
var html = [];
|
||||
$.each(row, function (key, value) {
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user