News for hackers. Stuff that matters.
Re:How to create loading image using CSS only by victormustar on Tuesday February 28, 2017 @08:55AM (#13753727)
I'm sorry but this looks awful. it could be -> https://jsfiddle.net/cp3r5bmk/
Re:How to create loading image using CSS only by exprA on Tuesday February 28, 2017 @10:42AM (#13754511)
That isn't even relatively close to being the same animation.

If that doesn't matter, who not just (paraphrasing):

  <blink>...</blink>
Re:How to create loading image using CSS only by victormustar on Tuesday February 28, 2017 @11:21AM (#13754854)
you can edit the keyframes very easily
Re:How to create loading image using CSS only by uncleleech on Tuesday February 28, 2017 @09:00AM (#13753763)
I opened this and saw the loading spinner and sat there wondering why it was taking so long to load the spinner :/
Re:How to create loading image using CSS only by Kubuxu on Tuesday February 28, 2017 @10:22AM (#13754336)
I was trying to change configuration of uMatrix so the spinner would load. I thought it was missing some scripts.
Re:How to create loading image using CSS only by ninju on Tuesday February 28, 2017 @10:30AM (#13754400)
I like your solution.

Where do you define the 'gap' in the cicle? I played around with the jsFiddle and could figure it out (still learning CSS wizardy)

Re:How to create loading image using CSS only by bpicolo on Tuesday February 28, 2017 @10:33AM (#13754424)
border-right-color (1/4 the border -> transparent)
Re:How to create loading image using CSS only by rocbear on Tuesday February 28, 2017 @08:29AM (#13753550)
The original author should really be credited for this: https://github.com/dimsemenov/PhotoSwipe/blob/703c415b1b97e8...
Re:How to create loading image using CSS only by leeoniya on Tuesday February 28, 2017 @08:29AM (#13753548)
Re:How to create loading image using CSS only by pharrlax on Tuesday February 28, 2017 @08:47AM (#13753671)
If you're going to build a loading indicator, you may as well go for a skeleton UI rather than a spinner. It's better UX practice because it lowers perceived load times and is much less jarring to swap in and out.

See: https://github.com/ksux/ks-design-guide/issues/38

Re:How to create loading image using CSS only by strombourg on Tuesday February 28, 2017 @08:50AM (#13753694)
The two are not mutually exclusive. Yep, a skeleton UI is great for filling out the canvas, but the addition of a spinner can indicate that "more stuff is coming".
Re:How to create loading image using CSS only by misterhtmlcss on Tuesday February 28, 2017 @10:19AM (#13754309)
I agree. A skeleton is good practice because you are progress and a spinner is great because it's allowing the user to understand the webpage is still loading which isn't always obvious.
Re:How to create loading image using CSS only by cptskippy on Tuesday February 28, 2017 @12:26PM (#13755495)
Google started doing this in Maps and I didn't know what it was or that it was intentional until I saw your post. My impression was that it was just an amateurish mistake of showing the unpopulated template.
Re:How to create loading image using CSS only by tyingq on Tuesday February 28, 2017 @09:41AM (#13754009)
Re:How to create loading image using CSS only by _ZeD_ on Tuesday February 28, 2017 @07:59AM (#13753394)
ok, now I'm asking... why? what this technique offer that a simple animated svg (or event a crusty .gif) don't? If the problem is the load time of the external asset you can still embed the image in the .css file directly...
Re:How to create loading image using CSS only by josephorjoe on Tuesday February 28, 2017 @08:34AM (#13753583)
I can think of a few advantages, the primary one being you do not need expertise in making graphic files to build this.

And once it is set up, it can be tweaked really easily from within the text editor you are already using for the rest of the project rather than having to jump out into Photoshop/Illustrator or ask the designer for a new asset.

Re:How to create loading image using CSS only by wilz on Tuesday February 28, 2017 @08:47AM (#13753666)
You can modify and finetune the look and timing of the animation in CSS code.

While this is also possible with SVG animations, they tend to be not as widely supported as CSS animations and at least I need to google for information about this topic as SVG is not an everyday topic for me.

Regarding GIF animations: they are larger in size and you first have to find and use tools to generate them. When avoiding the additional request: data URLs are ugly.

Re:How to create loading image using CSS only by sametmax on Tuesday February 28, 2017 @08:26AM (#13753524)
It's just fun.
Re:How to create loading image using CSS only by mozumder on Tuesday February 28, 2017 @09:34AM (#13753963)
After a certain point, the size of this code becomes larger than the size of an animated GIF or SVG.
Re:How to create loading image using CSS only by ravenstine on Tuesday February 28, 2017 @12:03PM (#13755222)
The thing about CSS is you can alter the properties very easily. You can use things like opacity to fake some things with gifs, but you can't change line thickness or color. My experience with SVG is that some things are easy to change with CSS and some aren't, depending on the browser. Support for SVG as background images is poor, so you have to have a bunch of tags declaring the file path or sprite in your markup if you need to use one graphic in multiple places. Using just CSS animation with pseudo elements, your graphic is declared in one place and can be easily changed and reused. Improvements to SVG support would make those advantages null, but that's why I have been using more CSS for small icons(eg indicators) and using SVGs for graphics(things like logos that will only show up on the page once).
Re:How to create loading image using CSS only by ams6110 on Tuesday February 28, 2017 @09:51AM (#13754088)
I had the same thought... how many KB of markup and stylesheets before you exceed the size of a small animated image.
Re:How to create loading image using CSS only by chrisnager on Tuesday February 28, 2017 @10:05AM (#13754195)
Here's my article from two years ago about creating this same spinner with a single HTML element.

See: http://chrisnager.github.io/simple-paper-spinner/

Re:How to create loading image using CSS only by andy_ppp on Tuesday February 28, 2017 @08:45AM (#13753647)
Is there a need for BEM with this (or ever)? Also I'd probably use :before and :after pseudo elements to avoid extra markup...
Re:How to create loading image using CSS only by pharrlax on Tuesday February 28, 2017 @08:48AM (#13753680)
Depends how much you value code readability vs. minimizing markup
Re:How to create loading image using CSS only by andy_ppp on Tuesday February 28, 2017 @10:15AM (#13754274)
Yes my __thoughts__ exactly; the __extra markup__ and __verbosity__ make things __much more difficult__ to understand.
Re:How to create loading image using CSS only by kentbrew on Thursday March 02, 2017 @12:11AM (#13771585)
Can also be done with an animated SVG, like so: https://gist.github.com/kentbrew/873fabf69f678a7b1d6127ea6e0...
Re:How to create loading image using CSS only by andreapaiola on Tuesday February 28, 2017 @11:42AM (#13755027)
Re:How to create loading image using CSS only by bluetwo on Tuesday February 28, 2017 @12:18PM (#13755404)
I was going to do something similar, but decided just to implement <progress> instead.
Re:How to create loading image using CSS only by the_cat_kittles on Tuesday February 28, 2017 @03:54PM (#13757708)
its very easy to inline a spinner image. thats another way to go.