common.js 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. $(function() {
  2. // Waves初始化
  3. Waves.displayEffect();
  4. // 数据表格动态高度
  5. $(window).resize(function () {
  6. $('#table').bootstrapTable('resetView', {
  7. height: getHeight()
  8. });
  9. });
  10. // 设置input特效
  11. $(document).on('focus', 'input[type="text"]', function() {
  12. $(this).parent().find('label').addClass('active');
  13. }).on('blur', 'input[type="text"]', function() {
  14. if ($(this).val() == '') {
  15. $(this).parent().find('label').removeClass('active');
  16. }
  17. });
  18. // select2初始化
  19. $('select').select2();
  20. });
  21. // 动态高度
  22. function getHeight() {
  23. return $(window).height() - 20;
  24. }
  25. // 数据表格展开内容
  26. function detailFormatter(index, row) {
  27. var html = [];
  28. $.each(row, function (key, value) {
  29. html.push('<p><b>' + key + ':</b> ' + value + '</p>');
  30. });
  31. return html.join('');
  32. }
  33. // 初始化input特效
  34. function initMaterialInput() {
  35. $('form input[type="text"]').each(function () {
  36. if ($(this).val() != '') {
  37. $(this).parent().find('label').addClass('active');
  38. }
  39. });
  40. }