How to remove the resizig handlers around an image in IE with javascript?

766 Views Asked by At

I have a small editor in my web site and I can add an image on it. I can resize the images using a jQuery plugin (Resizable). For this reason I had to disable the resizing borders around the image. In Firefix I did it using this:

 execCommand("enableObjectResizing", false, false);

and it worked fine. How can I do something similar for IE?

Thanks in advance

2

There are 2 best solutions below

0
On

If you want to achieve the same effect in IE11, you can use this code (javascript):

function controlselectHandler(evt) {
    evt.preventDefault();
}
document.body.addEventListener('mscontrolselect', controlselectHandler);

This removes the handles and resizing functionality. The cursor still changes to a resize cursor on hover, but this should be solveable with css.

I am not sure whether this will work in previous version of IE.

1
On

You can't, I'm afraid. The only way to include a non-resizable image in an editable element in IE is to set it as the background image of an element and ensure that element does not have layout.