1
0
mirror of https://github.com/picocms/pico-theme.git synced 2025-01-17 04:18:13 +01:00

Fix utils.slideUp() and utils.slideDown() in IE9

IE9 doesn't support sliding, but also doesn't support requestAnimationFrame(). Use setTimeout() with a delay of 16ms (1000ms / 60fps = 16.67ms) instead. This isn't optimal, but who cares about IE9... This is also true for IE8, even though we don't officially support it.
This commit is contained in:
Daniel Rudolf 2017-12-11 14:56:50 +01:00
parent 86e6d344b0
commit a958759cb1
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538

View File

@ -35,7 +35,7 @@ utils.slideUp = function (element, finishCallback, startCallback)
if (!utils.canSlide()) {
if (startCallback) startCallback();
element.className += (element.className !== '') ? ' hidden' : 'hidden';
if (finishCallback) window.requestAnimationFrame(finishCallback);
if (finishCallback) window.setTimeout(finishCallback, 16);
return;
}
@ -83,7 +83,7 @@ utils.slideDown = function (element, finishCallback, startCallback)
if (!utils.canSlide()) {
if (startCallback) startCallback();
element.className = element.className.replace(/\bhidden\b */g, '');
if (finishCallback) window.requestAnimationFrame(finishCallback);
if (finishCallback) window.setTimeout(finishCallback, 16);
return;
}