我最近在javascript中编写了一个window.resize,用于调整某些条件的浏览器窗口大小。从垂直分辨率900开始,继续调整浏览器窗口的大小,直到高度变为400,然后停止调整大小。但是当我清除它的处理程序时,浏览器窗口会不断调整大小。 有什么办法可以在限制后停止浏览器调整大小吗?
//here is the sample code
Sys.Application.add_load(function(sender, args) {
$addHandler(window, 'resize', window_resize);
});
var resizeTimeoutId;
var initWdth = (document.body.clientWidth - 200);
function window_resize(e) {
window.clearTimeout(resizeTimeoutId);
resizeTimeoutId = window.setTimeout(function() {
if (screen.height >= 768 && initWdth <= (document.body.clientWidth - 200)) {
document.body.scroll = "no";
//code here
//Enter if window maximized
//working fine.
}
else {
document.body.scroll = "yes";
if (document.documentElement.clientHeight >= 400) {
//mean 400 is our limit
}
else {
//Now stop resizing everything //Div's table etc
//browser window should stop resizing.
//$clearhandler(window, 'resize', window_resize); worked but browser window can't stop resizing
//after clearing the handler resize event not working but browser window keep resizing.
}
}
}, 10);
}
由于