The answer you chose correctly is not entirely correct. This is achievable:
Use the useless helper to stop resizing in a resize event:
$( ".selector" ).resizable({ resize: function(event, ui) {
In the resize event, the dimensions and position you want to resize. You still have a problem with the stop event. Before starting the stop event, jquery resizes your element, which you don't want. All you can do is reset the state of the object, as this was the last time a resize event was triggered. Thus, in a stop event, you can reset to resize and position your size as you set them in the last "resize" event that was called. To do this, you will need to declare some variables in a higher context or use the jquery element.data () method - your choice (you can even create an invisible clone of the entire object if it seems more convenient to you). Here is an overview of the final code structure:
$( ".selector" ).resizable({ resize: function(event, ui) { // resize $(this) as you wish and then save the dimensions and positions to some variables declared in a higher context }, helper: $("</div>"), stop: function(){ // restore $(this) position and location as it was last set in the resize event } });
Radu Simionescu
source share