I've couple of resizable objects and I'd like to trigger function 'changeS()' when I stop resizing the object.
Function changeS() should takes as first argument the name of the object for which it's called.
I mean:
when I stop resizing object "#resizable0" then should be called changeS(#resizable0,new_size - old_size),
when I stop resizing object "#resizable1" then should be called changeS(#resizable1,new_size - old_size), etc.
There is everything OK when I just set in code this method for every object i have, but I'd like to do it in loop for(), because there will be much more objects, and then I have a problem:
var old_size=0;
var new_size=0;
var x,i;
for(i=0; i<5; i++){
x = "#resizable"+i;
var $res = $(x);
$res.resizable({
grid: 22, minHeight:22, handles: 's',
start: function(event,ui) {
old_size = ui.originalSize.height;
},
stop: function(event,ui) {
new_size = ui.size.height;
if(new_size!=old_size)
changeS($res,new_size - old_size);
}
});
}
I don't know how to correctly pass a name of object as an argument of the function.
When function changeS() is executed it's always called with the same name - name of the last created object ("#resizable5" - in this case).
My question is:
How do I make for each object the function changeS() was called with the corresponding argument(name of this object)?
Thanks, popKonr