SL3 - have print button on 1 slide but JavaScript not launching printer ?
Jun 02, 2020
I have a Certificate with a print button only on that slide.
To print, the User will click the Print Certificate button I've inserted and on which I've assigned a Trigger with the following copied/pasted JavaScript:
if (document.location.href.indexOf(‘html5’) < 0) {
GetPlayer().printSlide()
} else {
if(!window.hasPrintStyle){
window.hasPrintStyle = true;
varcss = ‘@media print {body * {visibility: hidden;}#slidecontainer, #slidecontainer * {visibility: visible;}#slidecontainer {position: absolute;left: 0;top: 0; }#slideframe {overflow: visible;}}’,
head = document.head || document.getElementsByTagName(‘head’)[0],
style = document.createElement(‘style’);
style.type = ‘text/css’;
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
}
varwhereNow = $(“#slidecontainer”).offset();
$(“#slidecontainer”).offset({top:0,left:0});
window.print();
$(“#slidecontainer”).offset(whereNow);
}
When I've published and previewed this slide on SCORM, nothing happens when I click Print Certificate.
What am I doing wrong, please?
7 Replies
If you are using Storyline 360 you will need to load jQuery.
Also check the console for any errors
It's Storyline3
How do I check the console for any errors please?
Thanks.
Check the console for any errors, should show which line it is failing on
Pardon my ignorance, newbie here, how do I check the console for any errors? Thank you.
It is under the more tools tab of your browser and is developer tools should show any errors.
Hi Phil - I've attached the error code. Thanks for your advice.
This discussion is closed. You can start a new discussion or contact Articulate Support.