I got two DIV container each of it contains a puzzle (realization with jquery draggables).
I also got one object which looks like:
var puzzle var puzzle = {
option1 = [],
init:function(container) { .... }
}
To start the puzzle for one DIV i use:
// left puzzle div
var puzzleLeft = puzzle;
puzzleLeft.init(leftContainer);
// right puzzle div
var puzzleRight = puzzle;
puzzleRight.init(leftContainer);
But for the left one its not working. Everything I’m going to do left, happens in the right one :/ When I uncomment the start code for the right one, it will work for the left 🙂
Seems to be the right one start code is wrong?
Is this a wrong way to create 2 instances of the puzzle?
Thanks
Matt
You can create class’ constructor instead of object:
And create two instances of it: