Jquery outerheight change

839 Views Asked by At

Could someone tell me how could I create a function which would initate after outer height has changed?

$("#some_id").bind("outerHeight().change", function () {
   do something
});

or

$("#someid").outerHeight().change(call some function);

Thank you.

1

There are 1 best solutions below

0
AudioBubble On

Custom events are the only i that i know of that can achieve this. can get a little messy though.

https://jsfiddle.net/1rnjkrdk/1/

$('div').on('resize', function(){
    if( $('div').outerHeight() >= 70  ){
        $('div').addClass('blueBorder');
    }
});

setTimeout(function(){
    $('div').animate({
        height:  '75px'
    },{
        duration: 1000,
        complete: function(){
            $('div').trigger('resize');
        }
    });
}, 3000);

Have you target listening to a particular event, then trigger said event on the target when you are ready.