javascript - Triggering an event when a css value changes -


how can call function when specific css variable changes (eg: height of particular div), using jquery?

there no "native" solution this. if you're strictly using jquery manipulation of css propertys, function hook or (duck punshing) best shot:

(function($) {     var _oldcss = $.fn.css;     $.fn.css = function() {         if( typeof arguments[0] === 'string' ) {             console.log('css property ', arguments[0], ' change elem: ', this);         }          return _oldcss.apply(this, arguments);     }; }(jquery)); 

this of course incomplete. if arguments[0] object need iterate on key/values. basic principle.

the thing solution is, .height() call .css(). so

$('div:eq(2)').height(55); 

would trigger css property height change elem: [div#custom-header]


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -