Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

contenteditable: trigger event on image resize when using handles

Just in firefox i want to trigger an event whenever the size of an image is changed.

When you click an image in a contenteditable area firefox gives it handles and you can adjust the size, as soon as the mouseup is done i want to trigger an event so i can get some information from the image, the rest is easy, i just cant find something that fires off when the handle is dragged and let go on the image.

Im guessing something in jquery could monitor the div using the live function.

like image 771
Kevin S Avatar asked Mar 03 '26 09:03

Kevin S


1 Answers

You may observe the DOMAttrModified-event:

editableDivNode
  .addEventListener ('DOMAttrModified', 
                      function(e)
                      {
                        if(e.target.tagName=='IMG'
                            && e.target.getAttribute('_moz_resizing')  
                              && e.attrName=='style' 
                                && e.newValue.match(/width|height/))
                        {
                          //do something here but don't prompt the user
                        }
                      }, 
                      false);
like image 116
Dr.Molle Avatar answered Mar 04 '26 22:03

Dr.Molle