Copy link to clipboard
Copied
Hello Together, i have created a JavaScript. If You execute the JavaScript You can see two eyes which follow the mousecursor.
If I save my JavaScript as a html-file. It works very well. But If I insert the JavaScript into Adobe Captivate9 it is not working.
Anybody ideas what the problem is?
Attached my Javascript:
<style>
#auge1 { font-family:"courier new"; font-size: 72pt; margin: 0px; position: absolute;}
#auge2 { font-family:"courier new"; font-size: 72pt; margin: 0px; position: absolute;}
#pupille1 { font-family:"courier new"; font-size: 36pt; margin: 0px; position: absolute;}
#pupille2 { font-family:"courier new"; font-size: 36pt; margin: 0px; position: absolute;}
</style>
<script>
var auge=44; //Höhe des Auges (entschricht 'o' bei 72pt)
var pupille=6; //Höhe der Pupille (entspricht '.' bei 36pt)
var hoehe=20; //Hoehe von oben
var links=300; //Anstand vom linken Rand
var abstand=55; //Abstand der Augen zueinander
function ausrichten()
{
document.all["auge1"].style.pixelLeft = links - auge/2 + pupille;
document.all["auge1"].style.pixelTop = hoehe - auge/2;
document.all["auge2"].style.pixelLeft = links + abstand - auge/2 + pupille;
document.all["auge2"].style.pixelTop = hoehe - auge/2;
}
function pupillen()
{
document.all["pupille1"].style.pixelLeft = links + (auge/2 - pupille) * Math.cos(Math.atan2(y-(hoehe ),x-(links)));
document.all["pupille1"].style.pixelTop = hoehe + (auge/2 - pupille) * Math.cos(Math.atan2(x-(links ),y-(hoehe)));
document.all["pupille2"].style.pixelLeft = links + abstand + (auge/2 - pupille) * Math.cos(Math.atan2(y-(hoehe),x-(links + abstand)));
document.all["pupille2"].style.pixelTop = hoehe + (auge/2 - pupille) * Math.cos(Math.atan2(x-(links + abstand),y-(hoehe)));
}
var x,y;
function maus()
{
x = window.event.x + document.body.scrollLeft - auge/2;
y = window.event.y + document.body.scrollTop - auge;
status = x + " " + y;
pupillen();
}
</script>
</head>
<body onload="ausrichten()" onmousemove="maus()">
<span id="pupille1" class="pupille1">.</span>
<span id="pupille2" class="pupille2">.</span>
<span id="auge1" class="auge1">o</span>
<span id="auge2" class="auge2">o</span>
Thanks!
Copy link to clipboard
Copied
How are you inserting the script?
Try zipping the HTML file and inserting as an HTML5 animation.
Copy link to clipboard
Copied
With copy and paste
Copy link to clipboard
Copied
That's not going to work.
You can't put html in the JS window.
Plus, you are creating elements. Zip the file and insert as an HTML5 animation.
Copy link to clipboard
Copied
Thank You, ist working well.
But now I have the Problem that i can´t push the button which I have created bevor to continue to the next page.
How can I solve this problem`?
Copy link to clipboard
Copied
put window.parent. in front of the JavaScript command. Something like:
window.parent.window.cpAPIInterface.next();
Copy link to clipboard
Copied
Can You Show me where I have exactly insert "window.parent.window.cpAPIInterface.next();"
inside my JavaScript above?
Copy link to clipboard
Copied
You said: "But now I have the Problem that i can´t push the button which I have created bevor to continue to the next page."
Where is this button?