Copy link to clipboard
Copied
Hello!
I use the Execute JavaScript function in Captivate 8 and it works very well. I want to modify this, though, for a project so that the popup opens in the center of the page. Does anyone have experience with this or have any suggestions? Here is the code I use in the script_window:
var win = window.open('url', 'popup', 'width=800, height=800, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');
win.focus();
Thank you all in advance!
Copy link to clipboard
Copied
A suggestion; is using Web Object an option in your project?
Copy link to clipboard
Copied
Thank you! That is a great idea, however, I want the object to open up in the center and the web object opens in the top left. Is there a way to add that function into the web object?
Copy link to clipboard
Copied
In regards of web object on the top left, you can simply position your web object on the top left but hidden.
Next, you could create an Advanced Action.
First line, execute the script to show pop up
Send line, tell Captivate to show the hidden web object.
Next step, attach the Advanced action to a button. Now, when this button is pressed, a popup will appear and a web object will be visible on the top left.
Copy link to clipboard
Copied
Someone's not getting the memo or reading the replies.
The original poster wants a SEPARATE popup window to open in the MIDDLE of the computer monitor.
Unfortunately, although getting a separate browser window to open IS possible, dictating where on the screen it opens is not something I have seen done. And in HTML5 or responsive output it would be out of the question anyway.
Copy link to clipboard
Copied
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
if (window.focus) {
newWindow.focus();
}
Copy link to clipboard
Copied
Ahh. I forgot we have a JavaScript guru in the house!