开发者

Change Browser Size to Specific height/width?

Since there doesn't seem to be a way for a user to take a screenshot of a webpage without using some sort of plugin, i figured i'd at least cater to the plug-ins. For example, Pagesaver, for firefox, lets me save just the visible portion of the website i'm viewing. To cater to this, i'd like to develop a script th开发者_如何学Cat changes my window size to the boundaries of a relevant parent div, or to a static width/height.

For example, i have a site with a static width and WS on the sides. I'd like to have a button that when clicked, changes the window's width to the width of the center column, so that no WS shows. (same goes for height if the page isn't full height) This way, if they have a plug-in like pagesaver, they aren't saving useless portions of the site.

Is this possible? It doesn't necessarily have to be a new window, resizing the current window would probably be less work/preferred. I know ads do this to me all the time, so it must be possible...


Resizing the window is easy, but I think resizing it to just show the content you want (automatically) is more involved. An easy solution would be to load just the div you want in a separate page, use the jQuery width() and height() functions on the div, and then window.resizeTo(width, height). Worth a try.


A quick Google search turns up this: http://members.iinet.net.au/~rkb/tips_HTML_window_size.htm

Just call window.resizeTo(newWidth, newHeight).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜