Jun
30
2010

So what is going on here?

This is an exercise using Ajax, php, javascript and css sprites.

what exactly is going on?

  1. There is a server request that gets the date from a php script.
  2. The date is returned with commas separating it into 3 values.
  3. Using javascript, this is split into an array.
  4. Conditional statements are applied (switch() statement) - based on the day/ month/ year to select correct background-position for the day, month, year, div background-image.
  5. A css sprite is set up that uses one image and background-position
  6. Coordinates are selected that reveal the correct part of the image that corresponds with the current date.

The whole point?

reduce number of server requests.

the sprite

This image was borrowed from - http://css-tricks.com/date-display-with-sprites/