Skip to content

Instantly share code, notes, and snippets.

@dmitry
Last active March 2, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry/5c9eee2044d85022f3529be887653d64 to your computer and use it in GitHub Desktop.
Save dmitry/5c9eee2044d85022f3529be887653d64 to your computer and use it in GitHub Desktop.
animation-name hack
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); }
}
// 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