July 17, 2009
WorkAtPlay.com - How It Was Made: The Slide Effect
The second installment in our "how it was made" series for WorkAtPlay.com
The second installment in our "how it was made" series for WorkAtPlay.com
There has been great reception to the Work at Play website design and effects. We have received several emails from intrepid geeks wondering how we pulled off all that cool jQuery eye-candy. After writing a few of these "how it was made" emails I think a blog post is in order. Without further delay, here is the behind the scenes story on WorkAtPlay.com!
On the WorkAtPlay.com homepage we use the jQuery Flip! plug-in in combination with some custom animations to give the "Flip & Scale" effect. This is a little more complicated than one might think, and deserves some explanation:
$(elem).click() handler.onEnd call-back is triggered. We use the onEnd call-back to insert the content for the work sample's "flipped side". This content is cleverly ready and waiting inside a hidden part of the original work sample tile (view source on the WorkAtPlay.com home-page to see for yourself). Oh, we insert the content with a basic $(flip_side).html(flip_content.html())$(elem).animate() method plus some handy CSS positioning$('#work-page .wrapper').offset().top$('#work-page .wrapper').offset().left$('#work-page .wrapper').width() + 1Math.ceil($('.work-sample').length / NUM_WORK_SAMPLE_COLS) * $('.work-sample:first').height()