Access - Ryan-Rutledge/FlashcardStacks GitHub Wiki
Accessing Stacks By ID
Stacks Array
The fc
class contains an associative array of Stack objects named stacks
. The key for each stack is its element id.
Example
// Store stack with HTML id 'unique_id' in variable 'curStack'
var curStack = fc.stacks['unique_id'];
// Flip current flashcard in curStack left
curStack.moveCard(fc.MOVEMENT.LEFT);
Enabled Arrays
The fc
class also contains arrays pointing to Stack objects according to their active enablers:
tiltStacks
- List of tilt enabled stacksdragStacks
- List of drag enabled stacksclickStacks
- List of click enabled stacksswipeStacks
- List of swipe enabled stacksarrowkeyStacks
- List of arrowkey enabled stacks
Example
// Flip current card right in all stacks with tilting enabled
fc.tiltStacks.forEach(function(stack) {
stack.moveCard(fc.MOVEMENT.RIGHT);
});