Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate _moz_resizing in Chrome or Edge?

So I want to image-resize client side, just like this, but not only in Firefox.

StackOverflow logo image resizing

Notice that the element generated in Firefox, has the attribute _moz_resizing = "true".

code generated in Firefox

The code is as simple as the following.

document.querySelector('p').contentEditable = true;
<p>
  <img src='http://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png' alt='stackoverflow icon'>
</p>

Is there any way to do this for Chrome and Edge too?. I you are going to provide a solution in JavaScript, I would like better if it's vanilla.js than jQuery. Thank you in advance.

like image 970
Jose Serodio Avatar asked Oct 31 '22 02:10

Jose Serodio


1 Answers

You can achieve this in chrome by wrapping the image with a div and adding this styles..

resize: both; 
overflow: auto; 

demo: https://jsfiddle.net/anwar3606/d184oqfz/

JQuery UI

JQuery UI provides very good resizability functions and is very easy to use. https://jqueryui.com/resizable/#default

like image 110
Anwar Hossain Avatar answered Nov 12 '22 14:11

Anwar Hossain