Appendix B: SlidePoint Module Javascript - Slidepoint Examples

Slidepoint

Appendix B: SlidePoint Module Javascript

Examples

Example 1: Running a Function When a Slide is Viewed By The User
To run a function when the user views a specific slide in your module, use the slide_##_onshow() function. 

So if you wanted to show a slide down modal window containing module instructions the when the user views the first slide of the module during an attempt, you would use the following snippet of code:

  var showInstructions = true;
  function slide_1_onshow() {
    if ( showInstructions == true ) {
      showInstructions = false;
      showMessage("Here are my Instructions ", "Instructions");
    }
  }

 

Example 2: Running a Function When the User Launches the Module
To run your own custom Javascript when the user launches the module, add a function named presentation_onload() to the module’s Javascript. The presentation_onload() function will be executed prior to the first slide coming into view.

So if you wanted to show a slide down modal window containing module instructions when the use launches the module, you would use the following snippet of code:

function presentation_onload() {
  showMessage("Here are my Instructions ", "Instructions");
}

 

Example 3: Performing an action on multiple Objects at once
You can use the jQuery Library to select multiple objects by their CSS Class (which you can assign using the CSS Class(es) section of the Selection Settings) to perform an action on all of them.

So if you wanted to hide all objects on the current slide that have the CSS Class hide_me” when the user clicks on an object set to run a custom function named “hide_objects()” you would use the following snippet of code:

function hide_objects() {
  $j("#slide_inner .hide_me").hide();
}

If you wanted to show all those objects again when the user clicks of a different object that is set to run a custom function named “show_objects()” you would use the following snippet of code:

function show_objects() {
  $j("#slide_inner .hide_me").show();
}