Skip to content

Commit

Permalink
Merge pull request #140 from Genius/transition-listener
Browse files Browse the repository at this point in the history
Listen for transitionend events
  • Loading branch information
davidjbradshaw committed Jan 18, 2015
2 parents d334649 + 6f3cf6c commit f3c98c0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/iframeResizer.contentWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
if ( true === autoResize ) {
initWindowResizeListener();
initWindowClickListener();
initTransitionListener();
setupMutationObserver();
}
else {
Expand Down Expand Up @@ -243,6 +244,18 @@
});
}

function initTransitionListener(){
function onTransitionEnd(e){
if (e.propertyName === 'height' || e.propertyName === 'width') {
sendSize('transitionend','Transition end');
}
}
addEventListener(window,'transitionend', onTransitionEnd);
addEventListener(window,'webkitTransitionEnd', onTransitionEnd);
addEventListener(window,'oTransitionEnd',onTransitionEnd);
addEventListener(window,'otransitionend',onTransitionEnd);
}

function setupMutationObserver(){

var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
Expand Down

0 comments on commit f3c98c0

Please sign in to comment.