LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG-Webdev] Resizing windows

[ILUG-Webdev] Resizing windows

Niall O Broin niall at linux.ie
Tue Mar 11 15:53:26 GMT 2003


On Tuesday 11 March 2003 14:20, you wrote:

> http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20275475.html
>
> has an IE only hack that could help in your problem. Detect if there is a
> horizontal scrollbar - if so make window wider. Ditto for vertical
> scrollbar.

Bingo ! Lee - that link referred to two attributes document.body.scrollWidth 
and document.body.scrollHeight which I think are IE specific.

Now the production code has: 

function resize() {
        if (document.layers) {
                window.innerHeight = document.height + 20;
                window.innerWidth = document.width;
                if (window.innerHeight > screen.availHeight - 30) {
                window.innerHeight = screen.availHeight - 30;
                // Allow for width of scrollbar
                window.innerWidth = document.width + 20;
                }
        } else {
                if (document.body.scrollWidth) {
                        w_width = document.body.scrollWidth + 30;
                        h_height = document.body.scrollHeight + 35;
                }
                self.resizeTo(w_width, h_height);
        }
}

These are slightly strange attributes, in that document.body.scrollHeight 
varies with the original height of the window, even for identical content. 
This may well be related to what Adam was talking about with an initial 
resize for IE. But in any event, I know have a solution which is pretty good 
for most browsers out there.




Niall



More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell