Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post

    resize the inside of a window

    this is something that i came up with a while back, but never got around to putting up. when you resize a window, you don't get the same result across different browsers because of different chrome sizes. the way around this, is to resize your window based on the visible document area. this function does that.

    this should work in IE4+ and NS4+. i've tested it in IE5+, and Moz 1+

    Code:
    <SCRIPT><!--
        self.resizeIn = function(new_w, new_h) {
        var old_w = self.innerWidth || document.body.offsetWidth;
        var old_h = self.innerHeight || document.body.offsetHeight;
        if (!new_w) { new_w = old_w; }
        if (!new_h) { new_h = old_h; }
        new_w -= old_w; new_h -= old_h;
    
        self.resizeBy(new_w,new_h);
        }
    //--></SCRIPT>
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #2
    New Coder
    Join Date
    Aug 2002
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    i'm confused..but this looks like something interesting and seems worth showing my ignorance.

    you can change the size of a viewers window?
    i'm sort of confused on the whole thing..

    could you post some sort of an example of this in action?

  • #3
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #4
    New Coder
    Join Date
    Aug 2002
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh ok, i think i was trying to confuse myself


    i guess, is it logical to use, considering you don't know what resolution most people are using, so wouldnt everything in the window have to be set up for the lower end res. ?

  • #5
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    in order to make things easier on myself, i work with percentages. that way, i never have to worry about whether this looks to big or small on a particular resolution.

    how to make a window, a percentage of the screen size:

    var width = screen.availWidth * .75;
    var height = screen.availHeight * .75;

    that would create a window, that is 75 percent of the screen's width and height.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #6
    New Coder
    Join Date
    Nov 2002
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why do that when you can use easy, cross browser banner, or anything else for that matter, resizing scripts like this one?

    Code:
    function size_banner()
    {
    if(screen.width == '800' && screen.height == '600')
    {
    var widt=screen.availWidth-(screen.availWidth*.0275);
    document.write("<img src='banner.jpg' style='position: absolute; left: 0; top: 0; border: 1px solid black;' id='banner' width='"+widt+"'>");
    }
    else
    {
    document.write("<center>\n <img src='banner.jpg' style='top: 0; border: 1px solid black;' id='banner'>\n</center>");
    }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •