global.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*全局自适应高度*/
  2. function autoFlashHeight(){
  3. var headerHeight = $(".header").height();
  4. var toolsbarHeight = $(".toolsbar").height();
  5. var ftoolsbarHeight = $(".toolsbar-f").height();
  6. // var feeRateToolsbarHeight = $(".toolsbar_feeRate").height();
  7. var bottomContentHeight = $(".bottom-content").height();
  8. var toolsBarHeightQ = $(".tools-bar-height-q").height();
  9. var toolsBarHeightD = $(".tools-bar-height-d").height();
  10. $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
  11. $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
  12. $(".main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
  13. $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
  14. $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
  15. $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
  16. $(".main-data-not").height($(window).height()-headerHeight-1);
  17. $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64);
  18. $(".side-content").height($(window).height()-headerHeight );
  19. $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight);
  20. $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
  21. $(".form-list").height($(window).height()-headerHeight-50 );
  22. };
  23. /*全局自适应高度结束*/
  24. $(function () {
  25. $(window).resize(autoFlashHeight);
  26. /*侧滑*/
  27. /* $(".open-sidebar").click(function () {
  28. $(".slide-sidebar").animate({width: "800"}).addClass("open");
  29. });
  30. $("body").click(function (event) {
  31. var e = event || window.event; //浏览器兼容性
  32. if (!$(event.target).is('a')) {
  33. var elem = event.target || e.srcElement;
  34. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  35. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  36. return false;
  37. }
  38. elem = elem.parentNode;
  39. }
  40. $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
  41. }
  42. });*/
  43. /*侧滑*/
  44. /*工具提示*/
  45. $(function () {
  46. $('[data-toggle="tooltip"]').tooltip();
  47. });
  48. });
  49. /**
  50. * 设置本地缓存
  51. *
  52. * @param {String} key
  53. * @param {String|Number} value
  54. * @return {void}
  55. */
  56. function setLocalCache(key, value) {
  57. const storage = window.localStorage;
  58. if (!storage || key === '' || value === '') {
  59. return;
  60. }
  61. storage.setItem(key, value);
  62. }
  63. /**
  64. * 获取本地缓存
  65. *
  66. * @param {String} key
  67. * @return {String}
  68. */
  69. function getLocalCache(key) {
  70. const storage = window.localStorage;
  71. if (!storage || key === '') {
  72. return null;
  73. }
  74. return storage.getItem(key);
  75. }