다음 코드는 F11 바로 가기 키를 사용할 수 있으므로 브라우저 창 전체 화면에서 두 번째 F11 바로 가기 키를 얻는 방법으로 원래 창 크기를 복원 할 수 있습니까? 몇 가지 조사를하는 동안 나도 같은 문제에 직면했다 NW.js F11 단축 키를 사용하여 전체 화면 창과 표준 창 사이를 전환하는 방법은 무엇입니까?
1
A
답변
0
<!DOCTYPE html>
<html>
<head>
<script>
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "F11",
active: function() {
// decide whether to leave fullscreen mode
// then ...
nw.Window.get().enterFullscreen();
}
}));
</script>
</head>
<body>
</body>
</html>
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "F11",
active: function() {
nw.Window.get().toggleFullscreen();
}
}));
또는 사용 :
window.isFullScreen = false;
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "F11",
active: function() {
if (window.isFullScreen) {
nw.Window.get().leaveFullscreen();
window.isFullScreen = false;
} else {
nw.Window.get().enterFullscreen();
window.isFullScreen = true;
}
}
}));
은 모두 개인적으로, 동일한 결과를 생성을 toggleFullScreen 방법을 사용하여
:
당신은 두 가지 옵션이 있습니다 코드가 보이기 때문에 toggleFullScreen 메소드를 선호합니다. 청소기.
희망이 도움이됩니다.
+0
도움 주셔서 대단히 감사합니다. 이 문제를 보도록 도와 주시겠습니까? 그것은 나를위한 한 달이되었습니다. 다시 감사합니다. https://stackoverflow.com/questions/47743534/how-to-shortcut-keys-in-the-main-window-and-pop-up-window-to-take-effect – tianyi
전체 화면으로 들어가기 전에 창 크기와 위치를 기억한 다음 종료 한 후에 복원하십시오. – Eric