admin管理员组

文章数量:1122847

jQuery

$('body > header').on('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend', function(event) { 
                    
    if (event.target && event.originalEvent.propertyName === 'height') {
        console.log('height changed');
    }

});

The CSS is transitioning from height: auto to height: 100% and vise-versa.

This works as expected in Chromium browsers but not in any other browser. In Firefox for example, when I console.log(event.originalEvent.propertyName) before the if parameter I get other property names but never height.

How do I get event.originalEvent.propertyName to return height as Chromium browsers do?

This returns undefined on all browsers:

$('body > header').on('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend', function(event) { 
    var evt = event.originalEvent || event;
    if (evt.propertyName === 'height') {
         console.log('height changed');
    }
});

jQuery

$('body > header').on('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend', function(event) { 
                    
    if (event.target && event.originalEvent.propertyName === 'height') {
        console.log('height changed');
    }

});

The CSS is transitioning from height: auto to height: 100% and vise-versa.

This works as expected in Chromium browsers but not in any other browser. In Firefox for example, when I console.log(event.originalEvent.propertyName) before the if parameter I get other property names but never height.

How do I get event.originalEvent.propertyName to return height as Chromium browsers do?

This returns undefined on all browsers:

$('body > header').on('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend', function(event) { 
    var evt = event.originalEvent || event;
    if (evt.propertyName === 'height') {
         console.log('height changed');
    }
});
Share Improve this question asked Dec 5, 2024 at 19:56 A-ZA-Z 116 bronze badges 4
  • It has been true that only Chrome would animate to/from auto for things like "height". Maybe it still is true. – Pointy Commented Dec 5, 2024 at 20:52
  • Is there any alternative solution? There MUST be a way to preform this check or a similar one in other browsers...? – A-Z Commented Dec 5, 2024 at 21:16
  • Well I understand your frustration, but recall that 10 years ago CSS transitions themselves were fairly exotic. Generally things go slow when the standards committee faces tough questions of how to decide what semantics should be in weird cases. – Pointy Commented Dec 5, 2024 at 21:41
  • Sorry, I didn't mean to hit you with the frustration lol

    本文标签: javascripteventoriginalEventpropertyName not working in any none Chromium browsersStack Overflow