Skip navigation
Currently Being Moderated

Using javascript to resize the window

Mar 20, 2012 1:20 AM

Tags: #javascript #resize #window

I've got a project that I would like to resize depending on which slide the learner is viewing.

 

I' aware that the javascript method:

window.resizeTo(width,height)

can be used to resize a window.

 

In my case I want it to be for the tall window:

window.resizeTo(1016,650)

and for the short window;

window.resizeTo(1016,165)

 

I'm also aware that you can tell a button (or anything else) to execute javascript.

 

I'm having trouble making it work, tough.

 

I've tried putting the method directly into the Script_Window for the button.

I've tried writing a function in the published file, then having the button call that function.

 

Can you paste javascript snippets into the Script_Window? Or do you need go the whole 9 yards and write the entire function, name the button instance, and tell the Captivate button to call that function?

 

I'm just now sure how much Captivate knows how to do and how much I need to tell it.

 

Thanks in advance!

 

Joe           

 
Replies
  • Currently Being Moderated
    Mar 20, 2012 4:35 AM   in reply to joetheyeti

    Not to burst your bubble, but resizing the window is really a bad practice.  Ever go to a website that resized your browser... remember how annoyed you got when they did it?  If at all possible, try to avoid the browser resizing altogether, and maybe scale the Captivate content to fit the window:

    http://captivatedev.com/2011/09/29/scaling-adobe-captivate-content-in- moodle/

     

    Jim Leichliter

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 20, 2012 11:42 AM   in reply to joetheyeti

    This is really a web browser issue and not a Captivate problem.  You're code above looks good.  You may need to terminate the line with a semicolon:

     

    window.resizeTo(1016,165);
    

     

     

    But there are a few caveats to this working:

    1. You can't resize a window or tab that hasn't been created by the window.open() function.
    2. You can't resize a tab if the tab is in a browser window with more than one tab.

     

    I think you'll find it problematic to implement cleanly across browsers.

     

    Have you considerd using an iframe?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 20, 2012 5:22 PM   in reply to joetheyeti

    Are you targeting a particular browser or are you trying to get this to work across all browsers?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points