Last active
March 2, 2017 13:45
-
-
Save dmitry/5c9eee2044d85022f3529be887653d64 to your computer and use it in GitHub Desktop.
animation-name hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
animation-duration: 0.001s; | |
} | |
@media screen and (min-width: 769px) { | |
body { | |
animation-name: media-table; | |
} | |
} | |
@media screen and (max-width: 768px) { | |
body { | |
animation-name: media-mobile; | |
} | |
} | |
@keyframes min-width-700px { | |
from { clip: rect(1px, auto, auto, auto); } | |
to { clip: rect(0px, auto, auto, auto); } | |
} | |
@keyframes min-width-1000px { | |
from { clip: rect(1px, auto, auto, auto); } | |
to { clip: rect(0px, auto, auto, auto); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// on condition | |
$('body').css('animation-name') !== 'media-mobile' | |
// on event | |
var dispatchEvent = function(event) { | |
if (event.animationName === 'media-mobile') { | |
$('.new__payment__summary__w').fixTo('stop'); | |
} else if (event.animationName === 'media-table') { | |
$('.new__payment__summary__w').fixTo('start'); | |
} | |
}; | |
document.addEventListener('animationEnd', dispatchEvent, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment