hexo-theme-amane/layout/plugin/animejs.ejs

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-10-16 05:28:42 +00:00
<% if (plugin !== false) { %>
<% if (head) { %>
<style>body{opacity: 0}</style>
<% } else { %>
<%- js(cdn('animejs', '2.2.0', 'anime.js')) %>
<script>
function isIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
var trident = ua.indexOf('Trident/');
return (msie > 0 || trident > 0);
}
$(document).ready(function () {
$('body').css('opacity', 1);
if (!isIE()) {
['.main > .column:first-child .card',
'.main > .column:nth-child(2) .card',
'.main > .column:last-child .card'].map(function(target) {
anime({
targets: target,
scale: [0.8, 1],
opacity: [0, 1],
duration: 300,
easing: 'easeOutSine',
delay: function(el, i, l) {
return i * 100;
}
})
});
anime({
targets: '.navbar-main',
translateY: [-100, 0],
opacity: [0, 1],
duration: 300,
easing: 'easeOutSine'
});
}
});
</script>
<% } %>
<% } %>