소스 검색

全屏自适应

pengjing 1 년 전
부모
커밋
9b616ce3d2
1개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 38 0
      YLShipBuildLandMap.Web/wwwroot/app/main/map-index.js

+ 38 - 0
YLShipBuildLandMap.Web/wwwroot/app/main/map-index.js

@@ -239,5 +239,43 @@
         $scope.getFloorList();
         $scope.getRoomDepOrServiceList();
 
+        //全屏自适应
+        /*$(document).on('keydown', function (e) {
+            var e = event || window.event || arguments.callee.caller.arguments[0];
+            if (e && e.keyCode == 122) {//捕捉F11键盘动作
+                e.preventDefault();  //阻止F11默认动作
+                var el = document.documentElement;
+                var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;//定义不同浏览器的全屏API      //执行全屏
+                if (typeof rfs != "undefined" && rfs) {
+                    rfs.call(el);
+                } else if (typeof window.ActiveXObject != "undefined") {
+                    var wscript = new ActiveXObject("WScript.Shell");
+                    if (wscript != null) {
+                        wscript.SendKeys("{F11}");
+                    }
+                }
+            }
+        });
+
+        //监听不同浏览器的全屏事件,并件执行相应的代码
+        $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange msfullscreenchange', function (e) {
+            if (document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement) {
+                // 当前处于全屏状态
+                console.log("已经进入全屏");
+                $scope.isShowMark = false;
+                $scope.isShowNowModal = false;
+                $scope.isShowSearchList = false;
+                $("#mapimg").css("height", $(window).height());
+            } else {
+                // 不在全屏状态
+                console.log("已经退出全屏");
+                $scope.isShowMark = false;
+                $scope.isShowNowModal = false;
+                $scope.isShowSearchList = false;
+                $("#mapimg").css("height", $(window).height());
+            }
+            $scope.$apply();
+        });*/
+
     });
 })(angular);