开发者

contenteditable: trigger event on image resize when using handles

开发者 https://www.devze.com 2023-03-27 07:14 出处:网络
Just in firefox i want to trigger an event whenever the size of an image is changed. Wh开发者_StackOverflow中文版en you click an image in a contenteditable area firefox gives it handles and you can a

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

Wh开发者_StackOverflow中文版en 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.


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消