LoginSignup
19

More than 5 years have passed since last update.

CSSだけで(送信中のAjaxなフォームの)ボタンにくるくるを表示する例

Last updated at Posted at 2013-10-23

※表示の制御はスクリプトで。

loading.gif

デモ:

.submit.loading::before {
    background-color: rgba(0,0,0,.5);
    content: "";
    display: block;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
}
.submit.loading::after {
    animation: rotate 1s infinite linear;
    content: "*";
    color: #fff;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
}
@keyframes rotate {
    0% { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

::beforeでオーバーレイを表示して、::afteranimationを設定してくるくる。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19