Using external js file to execute functions - find/get current slide numbers
Hey there, I'm working on a Captivate project and using an external javascript file to control my navigation buttons. Besides not having to republish my project over and over again, I like using an external javascript file to animate my navigatoin buttons a bit with greensock.
I'm really rusty with javascript and people on the forums have helped me a lot in getting as far as I am - currently my external js file starts out with -
var interfaceObj;
var eventEmitterObj;
window.addEventListener("moduleReadyEvent", function(evt){
interfaceObj = evt.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();
});and then all my animations/functions are placed inside of the initializeEventListeners(); function.
The issue I'm running into is I've written out functions for my back button (with an id of 'backBtn'), but that button doesn't show up until the second slide of the project - so when the project tries to read my javascript on the first page it throws errors at me since the 'backBtn' doesn't techincally exist yet (I'm guessing that's why?)
My question is - how could I set it so that my functions for my back button don't try to execute or be read until I'm on the second slide of my project. I've tried a few different ways to get the slide numbers and put in an if statement about it - but so far all my attempts are failing.
In general I think it would be really nice to be able to determine which slide/slides I want a function to be 'located' on (if that makes sense)? But I'm not sure what is the best way to go about this. Any advice is appreciated a lot, thanks!
