Is it possible to listen to a “style change” event?

前端 未结 11 1240
南笙
南笙 2020-11-22 08:03

Is it possible to create an event listener in jQuery that can be bound to any style changes? For example, if I want to \"do\" something when an element changes dimensions, o

11条回答
  •  执笔经年
    2020-11-22 08:31

    you can try Jquery plugin , it trigger events when css is change and its easy to use

    http://meetselva.github.io/#gist-section-attrchangeExtension
    
     $([selector]).attrchange({
      trackValues: true, 
      callback: function (e) {
        //console.log( '

    Attribute ' + e.attributeName +' changed from ' + e.oldValue +' to ' + e.newValue +'

    '); //event.attributeName - Attribute Name //event.oldValue - Prev Value //event.newValue - New Value } });

提交回复
热议问题