What is the best way to determine when Lectora's scripts are complete/page objects are available?

chrystalb21
chrystalb21 Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 27 ✶ Headliner ✶
We have some actions and rungroups that are being called from javascript. This worked just fine in Lectora 16 (and before), but in Lectora 21 objects are being rendered later, so am having issues with the actions/rungroups being called before the objects are available on the page. Does anyone know the best way to determine when Lectora's scripts are complete and all page objects are available?

Answers

  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭
    Have you tried having the JavaScript triggered by the object's "OnShow" event?
  • chrystalb21
    chrystalb21 Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 27 ✶ Headliner ✶
    Thanks for the suggestion. Our script runs at the top level, and if we were to change it to on OnShow event, it would have to be done on the last object of every page, so that wouldn't be feasible for us. I have successfully used the following code that looks at the Lectora variable bPageLoaded.

    var loadInt=setInterval(start,100);
    function start(){
    if(bPageLoaded){
    clearInterval(loadInt);
    //Code to run
    }
    }