JavaScript for Instructional Designers
Add custom interactivity without becoming a developer
Welcome! In this 30-minute course, you'll learn practical JavaScript skills specifically designed for instructional designers working with Articulate Storyline.
What you'll build:
- Custom interactive components
- Advanced animations with GSAP
- Accessible code patterns
- Ready-to-use code templates
Prerequisites: Basic understanding of Storyline and familiarity with HTML/CSS (a refresher will be provided).
Understanding Storyline's JavaScript Window
When you add JavaScript to Storyline, you're working within the Storyline Player Window. This is the runtime environment where your code executes.
Key Global Object: GetPlayer()
This returns the Storyline player instance, giving you access to variables, triggers, and the slide environment.
When does code execute?
- On Load: When the slide first loads
- On Click: When a user clicks a button or shape
- On Change: When a variable or state changes
Your First Custom Interaction
Let's build something immediately visible. Here's a simple click counter with visual feedback:
Click the button below
What's happening: Each click increments a variable and updates the display instantly. This same pattern works for scoring, progress tracking, and conditional logic.
Storyline Variables via JavaScript
Variables are the bridge between your JavaScript and Storyline's logic. Create variables in Storyline, then control them with code.
Three Essential Methods:
GetPlayer().GetVar(name) β Retrieve a variable value
GetPlayer().SetVar(name, value) β Set a variable value
GetPlayer().GetVar(name) β Check before using
Knowledge Check: Variables
Question: What does GetPlayer().GetVar("Score") do?
Debugging: Your Secret Weapon
Every browser has built-in developer tools. Learning to use them will save you hours of frustration.
Open Developer Tools:
- Windows/Linux: Press
F12 - Mac: Press
Cmd + Option + I
Using console.log(): The most important debugging tool
Pro Tips:
- Add console.log at the start of functions to confirm they run
- Log variable values before using them
- Watch for null or undefined values
Building Reusable Components: Accordion
Accordions are a perfect first reusable component. They're common, accessible-friendly, and demonstrate core JavaScript patterns.
JavaScript is a programming language that runs in browsers, allowing you to create interactive web experiences. In the context of e-learning, it enables dynamic content manipulation and user interactions.
Insert a web object or shape/button, then add an trigger with "Execute JavaScript" action. Paste your code in the dialog. The code runs when the trigger fires (on load, on click, etc.).
Yes, but you don't need to be a professional developer. Focus on patterns and examples. This course provides templates you can customize without starting from scratch.
Smooth Animations with GSAP
GSAP (GreenSock Animation Platform) is the industry standard for animations. It's lightweight, performant, and intuitive.
Basic GSAP Syntax:
Common Animation Properties:
opacityβ Fade in/out (0 to 1)yβ Move up/down (pixels)xβ Move left/right (pixels)scaleβ Grow/shrink (0.5 to 1.5, etc.)rotationβ Spin (degrees)
Easing Functions: Control animation feel. Common ones: power1.out, power2.out, back.out, bounce.out
Accessibility When Adding Code
Your interactive components must work for everyone. This isn't optionalβit's professional responsibility.
Keyboard Navigation: Users should navigate using Tab and Enter.
ARIA Labels: Help screen readers understand your components.
Testing: Use keyboard-only navigation. Try a screen reader (NVDA is free).
- olor contrast: Text must be readable for people with vision impairments
- Focus indicators: Users must see which element has focus
- Animation controls: Provide pause options for animated content
Hands-On: Build Your Accordion
Now it's your turn. Below is a template accordion. Click "Customize" to modify the content and styling.
By the end of this module, you'll understand how to integrate JavaScript with Storyline variables.
You'll be able to build reusable, accessible components using modern JavaScript patterns.
Challenge: Try adding a third accordion item yourself. Copy the structure, change the text, and test it.
Reflection: What part of building this accordion was clearest to you?
Real-World Integration: Step by Step
Here's exactly how to use these components in your actual Storyline projects:
- Create a web object in Storyline (Insert β Web Object)
- Choose "Use an external URL or embed HTML"
- Paste the component HTML/CSS/JS into the editor
- Customize colors/text to match your course brand
- Test in preview (F5 in Storyline)
- Connect to Storyline variables using GetPlayer().SetVar()
- Publish and test in your LMS (SCORM, xAPI, etc.)
Pro Tip: Create a "Components Library" file in Storyline. Save each component as a master slide. Then duplicate it for new courses. This saves time and ensures consistency.
Your Template Library
You now have working code for all these patterns. Click any card to view the full template code:
01. Interactive Counter
Track clicks, submissions, or any user action. Great for gamification.
02. Custom Accordion
Organize content hierarchically. Saves space, improves navigation.
03. Animated Components
Use GSAP for entrance animations, transitions, and micro-interactions.
04. Accessible Patterns
ARIA labels, keyboard navigation, focus management templates.
Click a card above to view its full code, then copy it into Storyline.
Template Code
Copy the code below and paste it into Storyline as a Web Object:
Next Steps & Resources
Continue Learning:
- MDN Web Docs β Comprehensive JavaScript reference
- GSAP Docs β Animation deep dives and examples
- Web Accessibility Initiative β ARIA, WCAG standards
Community & Support:
- Join ID-focused Discord communities
- Share your components with other IDs
- Attend webinars on e-learning technology
Challenge for Next Week: Take one component from this course and adapt it for a real project. Share screenshots or code snippets in your learning community!
Course Complete!
Congratulations! You've completed JavaScript for Instructional Designers
Certificate of Completion
Learner
Issued:
You can now:
- β Write custom JavaScript for Storyline
- β Build reusable, accessible components
- β Create smooth animations with GSAP
- β Debug and troubleshoot code effectively
- β Integrate code into production courses