Please check my code below. I am using JQuery UI for Resizable. I have margin on an image and then I am applying JQuery resizable on image click and i am removing it when I click outside the image. Everything is working fine but except this behavior is removing the margin from image. Is there any way to keep the margin?
HTML
<img src="http://4.bp.blogspot.com/-DQ69szlhi38/UCJwZqNfcJI/AAAAAAAAAcY/6gsenl0Mwr8/s72-c/google.jpg" style="margin:20px;"/>
JQuery
$('document').ready(function(){
$('img').click(function(){
$(this).resizable();
});
});
$(document).mouseup(function (e) {
var container = $('img');
if ((!container.is(e.target)
&& container.has(e.target).length === 0)) {
if ($('img').hasClass('ui-resizable')) {
$('img').resizable('destroy');
}
}
});
Please check the code in jsfiddle http://jsfiddle.net/wgdvza8j/3/
I figured out the issue. I am now pulling the margin from ui-wrapper and then applying on the image. Please check my code on js fiddle http://jsfiddle.net/wgdvza8j/6/
HTML
JQuery