【问题标题】:Making a loading spinner制作加载微调器
【发布时间】:2021-04-11 20:06:01
【问题描述】:

朋友们,我需要您的帮助来为 ajax 请求创建加载微调器。它看起来像这样:working sample video

这是微调器的 HTML

这是这个微调器的 css:

$(document).ready(function() {
	$loading_indicator = $(document).find( '.loading-indicator' );
	$loading_indicator.addClass( 'active' );
	$loading_indicator.removeClass( 'active' );
});
.loading-indicator {
  width: 40px;
  height: 40px;
  background-color: #ddd;
  border-radius: 100%;
  -webkit-animation: sk-scaleout 1.0s infinite ease-in-out;
  animation: sk-scaleout 1.0s infinite ease-in-out;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s linear, visibility 2s ease;
  position: absolute;
  top: 0;
  margin: 0 auto;
  left: 0;
  right: 0;
}

.loading-indicator.active {
visibility: visible;
opacity: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="loading-indicator" style=""></div>

请帮助我使它工作, 因为我希望它像视频一样闪烁 在处理ajax请求时

【问题讨论】:

标签: jquery css spinner


【解决方案1】:

html,
body {
  background: #ed5565;
  color: #fff;
}

.ball-scale>div {
  background-color: #fff;
  width: 15px;
  height: 15px;
  border-radius: 100%;
  margin: 2px;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  display: inline-block;
  height: 60px;
  width: 60px;
  -webkit-animation: ball-scale 1s 0s ease-in-out infinite;
  animation: ball-scale 1s 0s ease-in-out infinite;
}

@keyframes ball-scale {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
  }
  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    opacity: 0;
  }
}
<div class="loader">
  <div class="ball-scale">
    <div></div>
  </div>
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-20
    • 1970-01-01
    • 2017-04-02
    相关资源
    最近更新 更多