我面临以下问题。HTML:
<div id='loading'>
<svg> /* inline SVG with animateTransform tags */ </svg>
<span>Loading, please wait...</span>
</div>
<button id='generateResult'></button>
<span id='result'></span>
记者:
$('#generateResult').click(function(){
$('#loading').fadeIn(100, function(){
// After showing the 'loading' container, run the calculate_result function
let result = calculate_result();
// When it's done, output the result into #result span
$('#result').html(result);
});
});
注意:这不是实际代码,只是一个快捷示例。
问题是执行该calculate_result函数大约需要 10 秒。在此期间#loading,容器应该是可见的,其中包含一个动画svg加载图标。但由于某种原因,该calculate_result函数导致 SVG 图标停止动画。
有什么办法可以防止这种情况发生吗?
有只小跳蛙
慕田峪9158850
随时随地看视频慕课网APP
相关分类