I have a question: How can I save my div's position (I have 3 div (with class: my_box_position)) to the cache and restore again using Mootools: My code:
Element.implement({
serializePos: function(){
var coors = this.getCoordinates();
return {
id: this.id.replace('rb_',''),
lefty: coors.top.toInt(),
leftx: coors.left.toInt(),
righty: coors.height.toInt() + coors.top.toInt(),
rightx: coors.width.toInt() + coors.left.toInt(),
minimized: this.hasClass('rb_minimized')
}.toSource();
}
})
Used like this:
var obj = $$('.my_box_position').serializePos();
Cookie.write('box_position',obj);
Now we read from cookie:
if (typeOf(Cookie.read('box_position')) != 'null') {
var boxes = eval(Cookie.read('box_position'));
...??? How can I set my div position here?
}
Thanks.