jquery resizable - is there any chance to get whether div is getting resized bigger or smaller than current size -
with jquery 'resizable' want resize div. .outerdiv has 1 more .innerdiv.
what want achieve is: when user resizes outer div, want calculate height of inner div (i can not give 100% height inner div).
i able new height this:
resize: function( event, ui ) { var currentheight = $('.table-container').height(); $('.table-container').height(currentheight+1); }
but when resize div smaller size want have
resize: function( event, ui ) { var currentheight = $('.table-container').height(); $('.table-container').height(currentheight-1); }
i not sure, how can condition, if resized upwards, size should smaller (height should - 1), , if downwards, size should bigger (height should + 1)
can give clues, how go it..
i believe function below solve problem. note semaphore , question mark operator:
function handleresizesignum(context) { var previousheight; var green = true; function refreshpreviousheight(h) { previousheight = h; } context.resize(function() { if (!green) return; green = false; refreshpreviousheight($(this).height($(this).height() + ($(this).height() >= previousheight) ? 1 : -1).height()); green = true; }); }
Comments
Post a Comment