Вобщем таблица заключена в дивы (спойлер), в нее по нажатию на строку добавляется строка и в нее подгружается контент, так вот запоминает размер этой таблицы спойлер только 1 рас. Еще проблемка в том, что после присвоения длины спойлером, при подгрзке размер элемента перестает изменяться.
// javascript Document
function sh(s) {
if (!this.progress || this.progress == 0){
obj = document.getElementById("sp"+s);
if( obj.style.display == "none" ) {
this.progress = 1;
obj.style.display = "block";
this.maxh = obj.offsetHeight;
obj.style.display = "none";
obj.style.overflow = "hidden";
function resize()
{
if (obj.offsetHeight >= this.maxh) {obj.style.height = this.maxh+'px';this.progress=0;obj.style.overflow = "inherit";}
else
{
var h = obj.offsetHeight + this.maxh/5;
obj.style.height = h + 'px';
setTimeout(resize, 0.01);
}
}
resize();
obj.style.display = "block";
}
else {
this.progress=1;
this.maxh = obj.offsetHeight;
obj.style.overflow = "hidden";
function resize2()
{
if (obj.offsetHeight <= this.maxh/5) {obj.style.height = this.maxh+'px';obj.style.display = "none";this.progress=0;obj.style.overflow = "inherit";}
else
{
var h = obj.offsetHeight - this.maxh/5;
obj.style.height = h + 'px';
setTimeout(resize2, 0.01);
}
}
resize2();
}
}
}
писал сам, ногами не пинать :)
Сообщение отредактировал 8 июня 2012 - 15:53