collapsibles
This commit is contained in:
parent
cbbcc8f707
commit
fe8c500a45
1 changed files with 55 additions and 21 deletions
|
@ -1220,6 +1220,7 @@ requires
|
||||||
var self = self || {},
|
var self = self || {},
|
||||||
that = new Ox.Element({}, self)
|
that = new Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
|
collapsed: false,
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
edge: "left",
|
edge: "left",
|
||||||
elements: [],
|
elements: [],
|
||||||
|
@ -1290,6 +1291,13 @@ requires
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
Ox.print("toggle");
|
Ox.print("toggle");
|
||||||
|
var size = self.options.collapsed ? 0 : -self.options.size,
|
||||||
|
animate = {};
|
||||||
|
animate[self.options.edge] = size;
|
||||||
|
self.options.parent.animate(animate, 200, function() {
|
||||||
|
self.options.collapsed = !self.options.collapsed;
|
||||||
|
Ox.print("callback");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
@ -4559,27 +4567,10 @@ requires
|
||||||
that.$elements[i] = v.element
|
that.$elements[i] = v.element
|
||||||
.css(edges[2], 0)
|
.css(edges[2], 0)
|
||||||
.css(edges[3], 0);
|
.css(edges[3], 0);
|
||||||
!Ox.isUndefined(v.size) && that.$elements[i].css(dimensions[0], v.size + "px");
|
|
||||||
if (i == 0) {
|
|
||||||
that.$elements[i].css(edges[0], 0);
|
|
||||||
!Ox.isUndefined(v.size) && that.$elements[i].css(
|
|
||||||
edges[1], (getSize(self.options.elements[1]) + (length == 3 ? getSize(self.options.elements[2]) : 0)) + "px"
|
|
||||||
);
|
|
||||||
} else if (i == 1) {
|
|
||||||
!Ox.isUndefined(self.options.elements[0].size) && that.$elements[i].css(
|
|
||||||
edges[0], getSize(self.options.elements[0]) + "px"
|
|
||||||
);
|
|
||||||
(!Ox.isUndefined(self.options.elements[0].size) || !Ox.isUndefined(v.size)) && that.$elements[i].css(
|
|
||||||
edges[1], (length == 3 ? getSize(self.options.elements[2]) : 0) + "px"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
that.$elements[i].css(edges[1], 0);
|
|
||||||
!Ox.isUndefined(v.size) && that.$elements[i].css(
|
|
||||||
edges[0], (getSize(self.options.elements[0]) + getSize(self.options.elements[1])) + "px"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setSizes();
|
||||||
|
|
||||||
$.each(self.options.elements, function(i, v) {
|
$.each(self.options.elements, function(i, v) {
|
||||||
//that.append(element)
|
//that.append(element)
|
||||||
that.$elements[i].appendTo(that);
|
that.$elements[i].appendTo(that);
|
||||||
|
@ -4606,10 +4597,53 @@ requires
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSize(element) {
|
function getPositionById(id) {
|
||||||
return element.size + !Ox.isUndefined(element.resizable);
|
var position = -1;
|
||||||
|
$.each(self.options.elements, function(i, element) {
|
||||||
|
if (element.element.options("id") == id) {
|
||||||
|
position = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSize(element) {
|
||||||
|
return element.size + element.resizable;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSizes() {
|
||||||
|
$.each(self.options.elements, function(i, v) {
|
||||||
|
!Ox.isUndefined(v.size) && that.$elements[i].css(dimensions[0], v.size + "px");
|
||||||
|
if (i == 0) {
|
||||||
|
that.$elements[i].css(edges[0], 0);
|
||||||
|
!Ox.isUndefined(v.size) && that.$elements[i].css(
|
||||||
|
edges[1], (getSize(self.options.elements[1]) + (length == 3 ? getSize(self.options.elements[2]) : 0)) + "px"
|
||||||
|
);
|
||||||
|
} else if (i == 1) {
|
||||||
|
!Ox.isUndefined(self.options.elements[0].size) && that.$elements[i].css(
|
||||||
|
edges[0], getSize(self.options.elements[0]) + "px"
|
||||||
|
);
|
||||||
|
(!Ox.isUndefined(self.options.elements[0].size) || !Ox.isUndefined(v.size)) && that.$elements[i].css(
|
||||||
|
edges[1], (length == 3 ? getSize(self.options.elements[2]) : 0) + "px"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
that.$elements[i].css(edges[1], 0);
|
||||||
|
!Ox.isUndefined(v.size) && that.$elements[i].css(
|
||||||
|
edges[0], (getSize(self.options.elements[0]) + getSize(self.options.elements[1])) + "px"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
that.resize = function(id, size) {
|
||||||
|
// one can pass pos instead of id
|
||||||
|
var pos = Ox.isNumber(id) ? id : getPositionById(id);
|
||||||
|
Ox.print("pos", pos, self.options.elements, $.map(self.options.elements, function(v, i) { return v.element.options("id"); }))
|
||||||
|
self.options.elements[pos].size = size;
|
||||||
|
setSizes();
|
||||||
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue