Circular loading indicator (border)

I stumbled upon this intriguing design concept on dribbble.

Do you think it's feasible to replicate the circular progress bar (with the progress being shown as the outer border of the circle) within the first few seconds of the gif?

Currently, I've managed to create the basic circle structure without any animation on jsfiddle

What should be my next step in moving forward with this project?

HTML:

<div class="circle"></div>

CSS:

body {
  background-color: #3a88cd;
  padding: 60px;
}

.circle {
  width: 60px;
  height: 60px;
  background: white;
  position: relative;
  border-radius: 100%;
}

.circle:after {
  content: "";
  display: block;
  position: absolute;
  top: -8px;
  left: -8px;
  bottom: -8px;
  right: -8px;
  border: 3px solid white;
  border-radius: 100%;
}

Answer №1

That was quite an enjoyable challenge! I had some free time, so I decided to tackle it head-on. The SCSS coding on JSFiddle was a breeze, especially with the added variables for customization. jQuery came in handy for adding a class on click.

If you're curious, check out the code in action here: https://jsfiddle.net/44ch0p8u/11/

For those who prefer a non-Sass version, take a look at the live demo below:

$('.circle').on('click', function() {
      $this = $(this);
      $this.removeClass('animate');
      setTimeout(function() {
        $this.addClass('animate');
      }, 50)
    })
body {
      background-color: #3a88cd;
      padding: 60px;
    }
    
    /* More CSS styling goes here */

    
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div class="circle">
      <div class="circle-inner"></div>
      <div class="circle-left"></div>
      <div class="circle-right"></div>
    </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can HTML emails support vertical text direction?

Looking to craft an html email? Do you want to try implementing vertical text direction within a table of an html email, similar to this example: https://i.sstatic.net/sffna.png I'm specifically interested in making the text "Belgium SABE.LIX ...." ...

Retrieve the matrix3d values from the -webkit-transform property

My current endeavor involves rendering 3D shapes using the <canvas> (2d context), requiring manual projective transformations. I am eager to retrieve the 3D transformation matrix values from the CSS, as that would greatly aid my process. Is it poss ...

Having difficulties with the edit function in JavaScript To Do Application

After creating an edit button to modify a task, it functions properly for the initial task I create. However, when attempting to edit subsequent tasks, the edit function defaults back to modifying the input of the first task instead. With each new ta ...

Does the margin fall within the element's boundaries?

Consider this code: <html> <head> <title>Understanding CSS Box Model</title> </head> <body> <section> <h1>An example of h1 inside a section</h1> </section> </body> </html& ...

Photo not completing the table

Hey there, I'm currently working on creating a table to showcase some products but I am struggling with ensuring that the images display at the correct size. Any assistance on this matter would be greatly appreciated. #tbldesktops { width: 100%; ...

Organize Radio Selectors

My intention was to align the radio buttons as shown in the image below: https://i.stack.imgur.com/oPTjD.jpg However, the final result looked like this https://i.stack.imgur.com/Mixga.jpg Below is the code for your reference HTML <div class="form ...

Webpage refreshing when resizing browser

Hey there, I'm facing an issue where my HTML website restarts whenever the browser size changes. Can someone please help me fix this? You can check out my website here I have uploaded my code files here: Code Files Link ...

Choosing jQuery over JQuery Mobile for a standard web application to effectively manage different devices

Creating a Unique Web Application In the works is a unique web application, similar to Trello, that divides a page into columns where tasks/cards can be added and moved between them. This desktop-focused platform will feature an information column on the ...

Strategies for Returning Multiple Values from a Function in JavaScript

Thanks in advance I am wondering how to extract multiple values from a code block using JavaScript. I am unsure if I need to use an array or something else as I am new to JS. Please consider the following HTML code: <div class="row"> ...

The ng-show animation is not functioning as anticipated

I've put together this Plunker, but I'm having issues with the enter and leave animations... The enter animation seems to be delayed, while the leave animation doesn't seem to work at all. Here is the CSS style: div.ng-enter { ...

Header image misalignment

Seeking a solution to have the image fill up the remaining space in the .container class I attempted setting the width of the image in CSS to width: 100%, but encountered two different results: Image with attribute set: https://ibb.co/9yKJgvF If I remove ...

Does the Width Toggle Animation fail to function in FireFox when using jQuery?

Has anyone else encountered this issue with the jQuery animate function not working in Firefox but working fine in IE8, Opera, and Chrome? I'm experiencing this problem and wondering if there's a workaround to make it work in Firefox as well. ht ...

Inspecting the options within a dropdown menu to adjust a styling attribute

I am in the process of developing a website that features multiple select options for creating sentences. My goal is to detect when users are changing these options to form specific sentences, such as changing "I", "Am", "Blue" to reflect the color blue. T ...

Floating elements can be vertically aligned with spans

I am facing an issue with aligning three spans vertically inside a div. It seems simple to achieve, but vertical alignment is not working properly when I use float. My goal is to have the light blue bar vertically centered. Here is the code snippet: .co ...

The popup is unable to remain in the center of the screen because the background page keeps scrolling back to the top

Whenever I click a button to open a popup window, the page unexpectedly scrolls to the top. It's frustrating because if I'm at the bottom of the page and press the 'submit' button, the popup doesn't display in the center as intende ...

Unique CSS styling technique

Is there a way to design a unique form similar to the one shown below using CSS? ...

Adjusting the width of a nested Angular custom directive within an *ngIf statement to an absolute value

I'm struggling with a custom angular directive that I only want to display conditionally using ng-if. The directive contains HTML elements, one of which is positioned absolutely. My goal is to make the absolute element's width match the root wid ...

Discovering mistakes in PHP MySQL

Is there an error in this code? Here's the code I'm working with. Thank you in advance for your help! else if(isset($_POST['UPDATECSSGOLD'])) { $stmt = $mysqli->prepare("UPDATE css set STYLE_STATUS = 'allnull'"); $stmt-& ...

Determine the size of a file in either megabytes or kiloby

I need to determine the size of a file in either megabytes if the value is greater than 1024 or kilobytes if less than 1024. $(document).ready(function() { $('input[type="file"]').change(function(event) { var _size = this.files[0].si ...

Restrict the amount of cards allowed in each card deck using Bootstrap 4

Is there a way to display up to 2 cards in a card deck and if there are more cards, have them displayed in a new deck below the previous one? How do I set the maximum number of cards for each deck? Where can this be specified? Here is a snippet of the HT ...