global.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*全局自适应高度*/
  2. function autoFlashHeight(){
  3. var headerHeight = $(".header").height();
  4. var toolsBar = $(".tools-bar").height();
  5. $(".content").height($(window).height()-headerHeight);
  6. $(".main-side").height($(window).height()-headerHeight-2);
  7. $(".main-content").height($(window).height()-headerHeight-2);
  8. $(".main-data").height($(window).height()-headerHeight-toolsBar-16);
  9. };
  10. $(window).resize(autoFlashHeight);
  11. /*全局自适应高度结束*/
  12. $(function(){
  13. /*侧滑*/
  14. $(".open-sidebar").click(function(){
  15. $(".slide-sidebar").animate({width:"800"}).addClass("open");
  16. });
  17. $("body").click(function(event){
  18. var e = event || window.event; //浏览器兼容性
  19. if(!$(event.target).is('a')) {
  20. var elem = event.target || e.srcElement;
  21. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  22. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  23. return false;
  24. }
  25. elem = elem.parentNode;
  26. }
  27. $(".slide-sidebar").animate({width:"0"}).removeClass("open")// 关闭处理
  28. }
  29. });
  30. /*侧滑*/
  31. /*工具提示*/
  32. $('*[data-toggle=tooltip]').mouseover(function() {
  33. $(this).tooltip('show');
  34. });
  35. /*工具提示*/
  36. });