• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using javascript to resize the window

Explorer ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

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           

TOPICS
Advanced

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

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              

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

Thanks for your response, Jim.

My window was created by a previous window using the code:

<script language="JavaScript">
function newWindow() {

TheNewWin = window.open("main.htm","newWin","status=no,resizable=yes,left=0,top=0,width=1014,height=650");
TheNewWin.focus()

}
</script>

I tried the code above in the ScriptWindow of a Captivate button (running in a Captivate SWF in the new window). It didn't work.

I also tried:

TheNewWin.resizeTo(1016,165);

and

newWin.resizeTo(1016,165);

neither of which worked.

Any other guidance would be appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

LATEST

Only IE 7 for Windows and up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources