Build dynamic Web presentations without Flash
Monday, December 7, 2009 11:13:37 PM
Just a week ago Chris Mills said that he is "planning a series of articles to show that you can really do all Flash type stuff using open standards". He also asked thoughts on what to cover. And in a couple days I stumble upon Flash photo portfolio presentation in New Yorker magazine and decided to convert it to standards. It looked pretty doable with CSS and JavaScript to me, so I decided to go with CSS-only, because I'm interesting in trying out some upcoming CSS3 goodies.
If you don't want to go into implementation details, here is a demo (alternative link). Sorry for stupid My Opera nag screen, no harm will be provided to you or your computer. Also you will need Google Chrome 4 or Safari 4 or Firefox 4 or Opera with Presto 2.3+ engine.
So, I started with examining the Flash presentation sample. Thankfully it appears that creators separated data (XML and pictures) from presentation (Flash), so anyone can pretty easily create their own implementation.
To locally saved XML I applied small XSL, that generated HTML markup for presentation, and that was pretty straightforward.
Here is most interesting part of HTML structure:<div id="name">
<div id="country">
<div id="age">
<div id="gender">
<div id="tenure">
<p id="menu">Order by:
<a href="#name" id="menu-name">Name</a>
<a href="#country" id="menu-country">Country</a>
<a href="#age" id="menu-age">Age</a>
<a href="#gender" id="menu-gender">Gender</a>
<a href="#tenure" id="menu-tenure">Tenure</a>
</p>
<ul>
<li>...</li>
<li>...</li>
...
</ul>
</div>
</div>
</div>
</div>
</div>
Now it was CSS turn. In two words: using :target pseudo-class I was able to switch sorting of photos, using CSS3 transitions I was able to show "visual sorting" and smooth fade-in-out effects. To show big pictures I decided to use :active pseudo-class (user needs to hold mouse button on a thumbnail). From CSS3 I also used RGBA and box-shadow.
-webkit-transition-property: opacity; -webkit-transition-duration: .6s; -webkit-transition-delay: .6s; -moz-transition-property: opacity; -moz-transition-duration: .6s; -moz-transition-delay: .6s; -o-transition-property: opacity; -o-transition-duration: .6s; -o-transition-delay: .6s; transition-property: opacity; transition-duration: .6s; transition-delay: .6s;
Once CSS3 transitions module will become a recommendation, we will need to add properties without vendor prefixes.
That is pretty much it. This CSS-only demo doesn't cover all functionality of original presentation, but sure that is 100% doable if we add some JavaScript and any technology to play audio files.
I tested this demo in Google Chrome 4, Apple Safari 4, and Mozilla Firefox 3.7 builds. Firefox seems has some glitches with CSS transitions, but it is useful even in this state. I added -o- prefixes, so someone can test this on Opera Mobile 10 (Presto 2.3) or next Opera for desktop (Presto 2.4).
Any comments, suggestions and corrections are welcome.








Nikita VasilyevELV1S # Tuesday, December 8, 2009 10:14:32 PM
ouzowtfouzoWTF # Tuesday, December 8, 2009 10:17:01 PM
Martin RauscherHades32 # Tuesday, December 8, 2009 11:36:57 PM
But chrome doesn't seem to keep :focus after I release the mouse button...
FataL # Wednesday, December 9, 2009 12:00:21 AM
So it is meant to behave like this.
MyOpera team, please fix this!fearphage # Wednesday, December 9, 2009 10:52:49 AM
Originally posted by FataL:
I'd say give up on myopera as file hosting. I did. The upload interface sucks and the nag screen is a pain. I use dropbox now which is not meant for that but it has a public folder to let you share what you want and since it's disk-based, you just copy files into a folder and you're done... and they are versioned. It also has a web interface so you can access your files from anywhere and it syncs the files to all of your computers/phones with the dropbox client installed.</endorsement>The demo link is down/404'd or something's wrong.
Charles SchlossChas4 # Wednesday, December 16, 2009 2:15:45 AM
MyOpera team, please fix this!fearphage # Wednesday, December 16, 2009 5:57:24 PM
FataL # Wednesday, December 16, 2009 6:09:01 PM
Originally posted by fearphage:
CSS sprites means I need to use background images. But then I can't scale up thumbnails.Anodynetherealanodyne # Saturday, April 10, 2010 7:34:40 AM
thanks for sharing it.
Peace wishes,
Anodyne
Андрей Охотниковdarvolok # Monday, January 23, 2012 9:49:47 AM
Андрей Охотниковdarvolok # Monday, January 23, 2012 9:49:47 AM