Walk thru your array by steps. You can move forwards and backwards.
Insert the oruga.js script into your stack.
- Create a new Oruga
var absolem = new Oruga([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
- ** Get the current state **
absolem.get(); // [1, 2, 3]
- ** Get the next step **
absolem.next(); // [2, 3, 4]
- ** Get the previous step **
absolem.prev(); // [1, 2, 3]
- ** Size ** (Default: 3)
var heimlich = new Oruga([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], { size: 5 });
heimlinch.get(); // [1, 2, 3, 4, 5]
heimlinch.next(); // [2, 3, 4, 5, 6]
- ** Step ** (Default: 1)
var heimlich = new Oruga([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], { step: 2 });
heimlinch.get(); // [1, 2, 3]
heimlinch.next(); // [3, 4, 5]
- ** Origin ** (Default: 0)
var heimlich = new Oruga([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], { origin: 3 });
heimlinch.get(); // [4, 5, 6]
heimlinch.next(); // [5, 6, 7]
Created by Jorge Vivas - 2014 License MIT: You are free to use and modify this code for any use, on the condition that this copyright notice remains.