www.webdeveloper.com
Results 1 to 3 of 3

Thread: Window Resize Toggle

  1. #1
    Join Date
    Mar 2009
    Posts
    34

    Window Resize Toggle

    Hey,

    quick question, is there a way to toggle window size with a single button like for example....

    window size starts as 500 x 500
    user presses button window opens up to 800 x 500
    user presses same button again, window goes back to 500 x 500

    any ideas on how to do this?

  2. #2
    Join Date
    Mar 2009
    Posts
    34
    Here's what i have so far, but of course doesnt work....

    Code:
    function showviewlog() 
    {
    if(window.size(835,381))
    document.getElementById("logview").className="visibleDiv";
    resizer();
    }
    else
    {
    if(window.size(835,691))
    document.getElementById("logview").className="hiddenDiv";
    resizer2();
    }
    }
    
    function resizer() {
    window.resizeTo(835,691)
    }
    
    function resizer2() {
    window.resizeTo(835,381)
    }

  3. #3
    Join Date
    Mar 2009
    Posts
    34
    Ok so i got this now.... this sorta works, it does change the window size and does change the classname for the div only problem is, it does it all at once.... instead of just acting like a toggle

    Code:
    function showviewlog() 
    {
    if(logview.className="hiddenDiv")
    {
    document.getElementById("logview").className="visibleDiv";
    resizer();
    }
    if(logview.className="visibleDiv")
    {
    closeviewlog();
    }
    }
    
    
    function closeviewlog() 
    {
    document.getElementById("logview").className="hiddenDiv";
    resizer2();
    }
    
    
    function resizer() {
    window.resizeTo(835,691)
    }
    
    function resizer2() {
    window.resizeTo(835,381)
    }

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
  •  
HTML5 Development Center



Recent Articles