Skip to main content
Inspiring
March 20, 2012
Question

Using javascript to resize the window

  • March 20, 2012
  • 1 reply
  • 2485 views

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           

This topic has been closed for replies.

1 reply

Legend
March 20, 2012

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

Inspiring
March 20, 2012

Jim,

This may be true in most cases. But I'm already having the user resize their window to make room for another document while still having the lesson on screen. I want to do it for them as a convenience. I'll let the beta tester tell me if it's annoying or not.

Can you give me any help with making this work in Captivate?

Joe              

Legend
March 20, 2012

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?