global.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*全局自适应高度*/
  2. function autoFlashHeight() {
  3. var headerHeight = $(".header").height();
  4. var toolsbarHeight = $(".toolsbar").height();
  5. var ftoolsbarHeight = $(".toolsbar-f").height();
  6. var bottomContentHeight = $(".bottom-content").height();
  7. var toolsBarHeightQ = $(".tools-bar-height-q").height();
  8. var toolsBarHeightD = $(".tools-bar-height-d").height();
  9. $(".main-data-side-q").height($(window).height() - headerHeight - toolsbarHeight - toolsBarHeightQ - 202);
  10. $(".main-data-side-d").height($(window).height() - headerHeight - toolsbarHeight - toolsBarHeightD - 202);
  11. $(".main-data-top").height($(window).height() - headerHeight - toolsbarHeight - bottomContentHeight - 1);
  12. $(".main-data-full").height($(window).height() - headerHeight - toolsbarHeight - 1);
  13. $(".main-data-full-fl").height($(window).height() - headerHeight - toolsbarHeight - 37);
  14. $(".main-data-not").height($(window).height() - headerHeight - 1);
  15. $(".main-data-side-search").height($(window).height() - headerHeight - toolsbarHeight - 64);
  16. $(".side-content").height($(window).height() - headerHeight);
  17. $(".poj-list").height($(window).height() - headerHeight - toolsbarHeight);
  18. $(".form-view").height($(window).height() - headerHeight - ftoolsbarHeight);
  19. $(".form-list").height($(window).height() - headerHeight - 50);
  20. };
  21. $(window).resize(autoFlashHeight);
  22. /*全局自适应高度结束*/
  23. $(function () {
  24. /*侧滑*/
  25. $(".open-sidebar").click(function () {
  26. $(".slide-sidebar").animate({width: "800"}).addClass("open");
  27. });
  28. $("body").click(function (event) {
  29. var e = event || window.event; //浏览器兼容性
  30. if (!$(event.target).is('a')) {
  31. var elem = event.target || e.srcElement;
  32. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  33. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  34. return false;
  35. }
  36. elem = elem.parentNode;
  37. }
  38. $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
  39. }
  40. });
  41. /*侧滑*/
  42. /*工具提示*/
  43. $(function () {
  44. $('[data-toggle="tooltip"]').tooltip()
  45. });
  46. // 数据提交
  47. $("#submit-form").click(function() {
  48. $("#save-form").submit();
  49. });
  50. });
  51. /**
  52. * 提示框
  53. *
  54. * @param string message
  55. * @param string type
  56. * @param string icon
  57. * @return void
  58. */
  59. function toast(message, type, icon)
  60. {
  61. var toast = $(".toast");
  62. toast.addClass(type);
  63. toast.children('.message').html(message);
  64. var iconClass = 'fa-' + icon;
  65. toast.children('.icon').addClass(iconClass);
  66. toast.fadeIn(500);
  67. setTimeout(function() {
  68. toast.fadeOut('fast');
  69. toast.children('.message').text('');
  70. toast.children('.icon').removeClass(iconClass);
  71. }, 3000);
  72. }