【插件】animate.css - 加载页面 - 显示动画


<link rel="stylesheet" th:href="@{dist/css/animate.css}"><!-- 动画效果 -->

<!--mind 中间内容-->
<div id="mainContentId" >
</div>



<script>//加载+动画
function doLoadUrl(url) {
	$('#mainContentId').load(url);
	animateCSS('#mainContentId', 'lightSpeedIn');
} ; 
function animateCSS(element, animationName, callback) {
    const node = document.querySelector(element)
    node.classList.add('animated', animationName)

    function handleAnimationEnd() {
        node.classList.remove('animated', animationName)
        node.removeEventListener('animationend', handleAnimationEnd)

        if (typeof callback === 'function') callback()
    }

    node.addEventListener('animationend', handleAnimationEnd)
}
animateCSS('#mainContentId', 'lightSpeedIn');
</script>
发布了296 篇原创文章 · 获赞 61 · 访问量 7058

猜你喜欢

转载自blog.csdn.net/LawssssCat/article/details/104080041