有没有人知道通过Javascript检查窗口完全打开的方法?
// code1 dont work
$(window).resize(function() {
...
});
// code2 dont work
window.onresize = function(event) {
...
}
我想在屏幕(浏览器)进入全屏时检查MOMENT。
答案 0 :(得分:1)
将窗口的outerHeight
和outerWidth
与screen.availWidth
和screen.availHeight
window.onresize = function(event) {
if (window.outerWidth === screen.availWidth && window.outerHeight === screen.availHeight) {
console.log("This is your MOMENT of fullscreen: " + Date());
}
答案 1 :(得分:0)
if( window.innerHeight == screen.height) {
// browser is fullscreen
}