Wall class creates a wall of elements that can be dragged. New elements are created by dragging The Wall.
Class constructor.
var wall = new Wall("mywall", [,options]);
1. Element id (required)
2. Options
Initialize The Wall building.
var wall = new Wall("mywall");
wall.initWall();
Verifies if The Wall is moving.
var wall = new Wall("mywall", {
"draggable":true,
"width":200,
"height":200,
callOnUpdate: function(items){
items.each(function(e, i){
var a = new Element("div");
a.set("html", "click me" );
a.inject(e.node);
// Behaviour on click
a.addEvent("click", function(e){
// Get Movement
if( wall.getMovement() ){
//... (move) your action
}else{
//... (no move) your action
}
})
}.bind( this ))
}.bind( this )
});
Returns the ID of inserted coordinates.
wall.getIdFromCoordinates(column,row);
1. column - Column item
2. row - Row item
var wall = new Wall("mywall", {...}).initWall();
tileId = wall.getIdFromCoordinates(2,4);
Returns the element coordinates according to its ID.
var wall = new Wall("mywall", {...}).initWall();
tileId = wall.getCoordinatesFromId(id);
id - id item
{
c: numeric,
r: numeric
}
Returns the active element ID.
This request should be mostly used in Coda functionality.
var wall = new Wall("mywall", {...}).initWall();
var id = wall.getActiveItem();
Returns a link list corresponding to the total number of elements created by The Wall.
This request should be mostly used in Coda functionality.
var wall = new Wall("mywall", {...}).initWall();
var id = wall.getListLinksPoints("idElement");
1. idElement: id element to update
List node items
[ a.wall-item-coda #1, a.wall-item-coda #2, a.wall-item-coda #3, ... ]
Executes all creation callbacks.
This method is automatically applied when preload option is set to true.
var wall = new Wall("mywall", {"preload":true}).initWall();
wall.preloadContent();
List node items
[
Object { node=div.tile, x=0, y=0},
Object { node=div.tile, x=0, y=1},
Object { node=div.tile, x=0, y=2},
Object { node=div.tile, x=0, y=3},
...
]
Callback executed when The Wall is updated and requires new elements.
var myFunctionUpdate = function( items ){
items.each(function(e, i){
// ... your code
})
}.bind( this );
var wall = new Wall("mywall", {...})
wall.setCallOnUpdate( myFunctionUpdate );
wall.initWall();
1. items is array new items
Callback executed when a new active ID is set.
var myFunctionChange = function( id ){
// ... your code
}.bind( this );
var wall = new Wall("mywall", {...})
wall.setCallOnChange( myFunctionChange );
wall.initWall();
id: id active item
Moves The Wall to the required coordinates.
mywall.moveTo( c, r );
c: Column coordinate
r: Row coordinate
Moves The Wall to the active element position.
mywall.moveToActive();
Moves The Wall to the following element.
This request should be mostly used in Coda functionality.
mywall.moveToNext();
Moves The Wall to the previous element.
This request should be mostly used in Coda functionality.
mywall.moveToPrev();