ho modificato la funzione x quello che deve realmente fare..il problema è che lo fà ma poi và in loop...datemi una mano please...
Codice PHP:
intervallo_allunga_x = null;
intervallo_allunga_y = null;
function resize_obj(id_oggetto,to_x,to_y,tipo) {
//tipo è 'y' o 'x' rappresenta la prima coordinata da modificare
var obj = document.getElementById(id_oggetto);
var tempo = 1;
if (tipo == 'y') {
var c_corrente = obj.clientHeight;
} else if (tipo == 'x') {
var c_corrente = obj.clientWidth;
}
if (tipo == 'y') {
to_c = to_y;
} else if (tipo == 'x') {
to_c = to_x;
}
if (c_corrente < to_c) {
var c = c_corrente+1;
} else if (c_corrente > to_c) {
var c = c_corrente-1;
}
if (c == to_c) {
if (tipo == 'y') {
clearInterval(intervallo_allunga_y);
intervallo_allunga_y = null;
intervallo_allunga_x = setInterval("resize_obj('"+id_oggetto+"',"+to_x+","+to_y+",'x')",tempo);
return;
} else if (tipo == 'x') {
clearInterval(intervallo_allunga_x);
intervallo_allunga_x = null;
itervallo_allunga_y = setInterval("resize_obj('"+id_oggetto+"',"+to_x+","+to_y+",'y')",tempo);
return;
}
} else {
if (tipo == 'y') {
obj.style.height = c+'px';
if (intervallo_allunga_y == null) {
intervallo_allunga_y = setInterval("resize_obj('"+id_oggetto+"',"+to_x+","+to_y+",'y')",tempo);
return;
}
} else if (tipo == 'x') {
obj.style.width = c+'px';
if (intervallo_allunga_x == null) {
intervallo_allunga_x = setInterval("resize_obj('"+id_oggetto+"',"+to_x+","+to_y+",'x')",tempo);
}
return;
}
}
}