Access - Ryan-Rutledge/FlashcardStacks GitHub Wiki

Accessing Stacks By ID

Stacks Array | Enabled Arrays


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 stacks
  • dragStacks - List of drag enabled stacks
  • clickStacks - List of click enabled stacks
  • swipeStacks - List of swipe enabled stacks
  • arrowkeyStacks - 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);
});