JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://doc.jsfiddle.net/_images/jsfiddle-desktop-thumbnail-a.png" style="width:300px; cursor:nw-resize"><br>

Breite: <input type="text" id="width" value="300" readonly>

JavaScript

var x=0;

$("img").mousedown(function(e){
	e.preventDefault();	
	x = e.pageX;
	$("body").mousemove( resize );
});

$("*").mouseup(function(e){
	$("body").unbind("mousemove");
});

function resize(e)
{
	var img=$("img");
	var x_diff = e.pageX - x;
	var x_current = parseInt(str_replace("px", "", img.css("width")));
    var x_new = x_current + x_diff;
	img.css({"width": x_new + "px"});
    $("#width").val(x_new);
	x = e.pageX;
}

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}