The CSS mainly uses transform, animation and keyframes styles and works in most modern browsers, with the exception of IE9 and below of course. Although at least in IE9 it does render the “first frame” correctly (i.e. the initial state of the loading icon). You can easily tweak colours, thickness, length or spacing of the lines. Oh and the html is dead easy, it’s basically just a
.spinner div with a bunch of
.spin-line divs inside. If you want to play around with live code you can check out my jsFiddle for it.
If you like this one, you should also check out this spin.js project by Felix Gnass that adds a bit of JavaSscript to give you more flexibility, control and provide better compatibility with older browsers including IE.
Read more »
var x = 2;
x == 2 && console.log('x is 2');
Is equivalent to
if (x == 2) console.log('x is 2');
Unless you’ve been living under a rock you heard of Google Plus. The new social project from Google is exploding like crazy and has already suppressed 10 million users — that’s after 2 weeks with very limited invitations for the first one. So if anything, it’s going to grow even faster once Google fully opens it up. As users are exploring Google+ they’re finding out the ins and outs of the service and figuring out various shortcuts and tricks that can be used, in fact they even started a collaborative project to keep track of everything there is to know about Google+.
One of the tips that caught my eye was for searching Google+ posts and profiles right from Chrome’s url bar. I quickly realized that this is easily doable in Firefox as well. So here’s a quick guide to setting up the Firefox awesome bar to search Google+ posts and profiles. Read more »
I have always been very performance conscious. It probably comes from my work as PC game developer where a single line of non-optimized rendering code could mean the difference between getting 60fps and 20fps during gameplay. In any case, I really enjoyed discovering some new tricks to squeeze more performance out of my code, and admittedly remembering some old ones as well. So I wanted to share some of those tricks, both the basic, but essential ones and the more advanced techniques. Read more »
A while back I made a post about a simple placeholder script I wrote. The idea was to provide the placeholder functionality that browsers like Chrome and Safari have, to browsers that don’t have it, like Firefox and IE. The script was very simple though and not smart in a few ways, including inability to handle password fields and an incorrect way of checking placeholder support in the browser. Since then I wrote an improved version of the script, in the form of a jQuery plugin. The highlights of this improved script include
- proper use of jQuery’s plugin framework to create a fully chain-able plugin
- support for password fields and text areas
- correct check for placeholder support in browser
- and just overall a better written piece of code
You can see a demo of the plugin in action and download the commented source file (4.7kb), or the minified source file (1.7kb), or the clean (not minified but not commented) source file (2.6kb). Below I’ll go over some of the more interesting parts of script. Read more »
I love CSS because it’s like having Photoshop inside a browser. Okay, maybe I’m exaggerating, but with modern browsers there are a lot of very cool things you can do with just CSS, without needing any of those pesky images with their overheads and extra kilobytes to download. In my work though I don’t often get a chance to try anything really interesting with buttons because they’re either simple, or if they’re not then I have to make them IE (worse yet, IE6) compatible so I end up reverting to mostly images anyway. So I decide to “go wild” and see what I can do without having to care about any of that compatibility nonsense.
Sidenote: Can you imagine if first cars had to be made horse-compatible? Yeah, think about that for a second.
So anyway, this is what I came up with.
Look ma, no images!
Here is a demo of the buttons, pretty much exactly what I used for the screenshot above. I go over the styles after the break.
Read more »
Check out the full tutorial at net.tutsplus.com.
HTML5 is the future of the web, but building the future is hard work and so it’s always great to get a bit of help with that. Some of that help comes in the form of HTML5 Boilerplate from the minds of Paul Irish and Divya Mani, who have teamed up to bring us “the professional badass’s base HTML/CSS/JS template for a fast, robust and future-proof site”. Boilerplate is basically a bunch of files, the exact kinds of files you would create as you start working on a new website, except that these already contain the basic starting code and include all the best practices baked in. Things like reset styles, pngfix, HTML5 markup and more. I went over most of it line by line and after a few adjustments based on my own personal preferences I’m going to start using it as the base for all websites I work on. Read more »