Search code examples
jqueryjquery-uijquery-ui-resizable

getting resized image new width and height


On resize i need to get the new width and height of the div, I have doing this script using jquery-ui and jquery but it fail

$(this).resizable(function(){
            console.log("Height: " + $(this).height());
            console.log("Width: " + $(this).width());
        }); 

help to find how to correct this error.


Solution

  • $(this).resizable()
           .on("resize", function() {
            console.log("Height: " + $(this).height());
            console.log("Width: " + $(this).width());
    });
    

    or

    $(this).resizable({
      resize: function(event, ui ) {
            console.log("Height: " + ui.height());
            console.log("Width: " + ui.width());
      }
    });