当用户点击我的浏览器动作时,我想它是相应的弹出窗口(几乎)填满屏幕。我需要的:当前窗口 基于窗口大小动态设置浏览器动作弹出窗口的高度
的
- 高度/宽度当
- 用户点击我的弹出
我知道我能得到高度/当前窗口的宽度与
chrome.windows.getCurrent(function(currentWindow) { console.log(currentWindow.height); });
,但我不知道如何知道我的弹出窗口是开放的ned(event),或者如何动态设置它的大小(在popup的检查器中设置document.body.width或window.inner/outerWidth似乎没有这样做)。谢谢!编辑:找到http://code.google.com/chrome/extensions/browserAction.html#event-onClicked,但它表示它不会触发它浏览器动作有一个弹出窗口,是绑定到弹出页面onload我想实现什么?
嗯,要调整弹出窗口? (manifest.json中的'browser_action.popup') – none12398
修复了它。我正在寻找这样的东西: window.onload = function(){ var htmlStyle = document.querySelector('html')。style; chrome.windows.getCurrent(函数(currentWindow){ htmlStyle.height =(currentWindow.height * 0.9)+ '像素'; htmlStyle.width =(currentWindow.width * 0.9)+ '像素'; console.log(htmlStyle.height,htmlStyle.width); }); }; 和[I猜] [1]有一个最大的宽度/高度(800/600像素),因此,上述刚给我说的滚动条 [1]:http://stackoverflow.com/questions/6904755 – none12398