开发者

Windows (pop-up) minimize in JavaScript

How can I minimize the pop-up windows I made on my website to keep i开发者_如何学运维t and call it again when I want?

Note : if there is an example to help it will be great.


You cannot minimize the browser window from within Javascript (...on any modern browser, though some ancient ones might allow it). I agree with this limitation: websites should have full control over what happens inside their browser window; they shouldn't have control over what happens to the window itself.

That being said, there are ways (sadly) of resizing the window using Javascript. Try this:

window.resizeTo(x, y);

You can also blur() the window, which theoretically causes the window to lose focus and moves it behind other windows.


Agreeing with @Closure Cowboy i wish to add that now days it becomes rare that a web site actually opens a pop-up window, usually it is done using a floating div element using CSS layers to display a look-a-like popup window which is actually part of the same HTML web page itself.

You can see some samples in the jquery ui dialog page. http://jqueryui.com/demos/dialog/

Using this method you have full control on the "window" and you can hide it / minimize it using javascript. Google use it in gmail tasks list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜