$(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('

' + key + ': ' + value + '

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