Andy Dust - Web Developer

"Hey. I'm a front-end developer.
Most of the time I'm tinkering with xHTML, CSS, Javascript and Actionscript.
Sometimes I use Ruby-on-Rails."

Turn your List elements into an animated carousel with CarouselJs (beta)

April 11th, 2009

I’m releasing a first (beta) version of my carousel script ‘CarouselJs’ (suggestions for better names are welcome…). It takes the ID of any OL or UL element and creates an animated carousel, placing a scroll button on either side of the list. The default options can be supplied in an object as a second argument. I intended the script to work in all modern browsers (including IE6), be unobtrusive, work with minimal extra mark up and to be easily customizable in terms of both configurable behavior and CSS presentation.

Here’s a demo (photos courtesy of Mark Haldane):

  1. photo
  2. photo
  3. photo
  4. photo
  5. photo
  6. photo
  7. photo
  8. photo
  9. photo
  10. photo
  11. photo
  12. photo
  13. photo
  14. photo
  15. photo

Demo code:

new CarouselJs( 'photos' , { speed: 45, pauseInterval: 0.5 } );

Read more about CarouselJs over here on the project page, including more examples.

If you happen to give it a whirl be sure to let me know what you think.

‘max-width’ for Internet Explorer

March 25th, 2009

Whilst implementing my new Wordpress theme, I came up with this quick snippet to achieve the ‘max-width’ CSS rule in Internet Explorer. Crucially, it avoids nasty CSS expression hacks, yet only comes into effect if a ‘max-width’ rule is explicitly set for the given element in your stylesheet, which hopefully means less housekeeping if you happen to alter your presentation in the future. Both IE6 and IE7 are capable of retrieving the computed style values despite not implementing them (IE7 actually implements max-width under a strict DOCTYPE).

function applyMaxWidth() {
  if(this.currentStyle) {
    var desiredMaxWidth = this.currentStyle["maxWidth"] || this.currentStyle["max-width"];
    if(desiredMaxWidth && this.offsetWidth > parseInt(desiredMaxWidth, 10)) {
      this.style.width = desiredMaxWidth;
    }
  }
}
applyMaxWidth.call(myElement);

Flash Video Carousel Prototype

June 14th, 2008

Over at bragster.com we’re hard at work on a site-wide upgrade in which web video is going to play a big part. In preparation, I’ve been prototyping a number of flash widgets including a carousel [see it in action]. Carousels are a great way to provide a list of rich media links in a small area of a page and technologies like flash/actionscript or javascript provide the opportunity to implement some creative interactivity.
Click here to see the flash video carousel in action.
Feedback has been positive but admittedly this implementation is far from ideal. Were I to ‘productionize’ this prototype I would need to optimize some of the effects for lower-spec computers (the blurred scrolling effect is particularly sluggish). The cursor based navigation would also need fine tuning, my friend Andy suggested modeling the velocity control on a bell-curve.

Annoyingly, I ran into problems when creating the reflection effect in that I couldn’t redraw/duplicate the thumbnail file with the BitmapData class. As a consequence the carousel currently loads each thumbnail twice. This morning I found a solution at developer Ryan Taylor’s blog, using the checkPolicyFile property on movieClipLoader.

No doubt I’ll post another update should this prototype ever make it into a production environment.

RSS Feed

latest tweet:

LOLWUT RT @guardiannews: Michael Owen on verge of shock move to Manchester United http://bit.ly/LNdb6

Follow me on twitter!

Working at: bragster.com

Contact:

Archives:

  1. April 2009
  2. March 2009
  3. June 2008

Categories:

  1. Actionscript (1)
  2. Javascript (2)
  3. Projects (1)
  4. xHTML & CSS (2)

I use:

  1. Flickr
  2. last.fm

People:

  1. Adam Perfect
  2. Mark Haldane
  3. Stuart Gleave
  4. The Maths Site

Meta