I'd like to add a spinner to my site and I'm wondering which method to use. My initial investigation resulted in the following (see links and Why not animated GIF instead of animated CSS sprites?):
Animated GIFs
Pros
- Depending on the specific spinner(s), may provide the smallest footprint (673 bytes for the default one from AjaxLoad)
- High browser compatibility
- Simple to use with data binding (simply bind to the visibility of the
img
tag)
Cons
- Gifs can't be changed once downloaded
- Gif animation can't be started/stopped reliably
- All instances animate at the same time in a synchronized manner
- Animation may freeze in some circumstances, such as HTML manipulation
JavaScript (spin.js)
Pros
- Highest browser compatibility (even falls back to VML)
- Highly dynamic and customizable
Cons
- Larger footprint (4.02KB for spin.min.js 2.0.1)
- Possible CPU usage issues (link)
CSS
Pros
- Dynamic and customizable
- Purely declarative (no JS)
Cons
- Larger footprint (4.32KB for one the default spinners from CSSLoad)
- Poorest browser support (requires CSS3)
- Possible CPU usage issues (link)
Do you agree with the analysis above?
In simple cases, would it make sense to go with gifs as they seem to keep things simple while being fairly compatible?