The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: browser resize

  1. #1

    browser resize


    ok im want to resize my browser window resizeBy() it works and all but i want it to smoothly size up or down not just jump the to the size

    anyway? in javascript


  2. #2
    Hi Aldo

    You can try this

    Put this in the head of your document

    <script language="javascript">
    function resizeSlow(width, height, maxWidth, maxHeight){
    //set flags to see if the width and height has been reached
    var heightmet = false;
    var widthmet = false;
    //detect the current width and height of browser window
    // actually the browser document
    //changes with OS and browser
    //With help from
    if (self.innerWidth)
        frameWidth = self.innerWidth;
        frameHeight = self.innerHeight;
    else if (document.documentElement && document.documentElement.clientWidth)
        frameWidth = document.documentElement.clientWidth;
        frameHeight = document.documentElement.clientHeight;
    else if (document.body)
        frameWidth = document.body.clientWidth;
        frameHeight = document.body.clientHeight;
    //if the document width is smaller than the required width...
    if (window.frameWidth <= maxWidth){
        //set the size to enlarge by
        var widthResizeBy = width;
        //set the size to enlarge by to 0 and set flag to TRUE. WE ARE THERE!!!
        var widthResizeBy = 0;
        var widthmet = true;
    // Do the same for the height
    if (window.frameHeight <= maxHeight){
        var heightResizeBy = height;
        var heightResizeBy = 0;
        var heightmet = true;
    // Actually resize the window now.
    window.resizeBy(widthResizeBy, heightResizeBy);
    // Check to see if the flags are raised
    // If they both are then we stop
    // else we call the function again
    if (widthmet && heightmet){
    resizeSlow(width, height, maxWidth, maxHeight);
    Then put this in the body
    <a href="#" onClick="javascript:resizeSlow(20,20,500,300);">Click</a>
    The function parameters are
    resizeSlow(widthEnlarge,heightEnlarge,maxWidth,max Height)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012