Flash without Flash: Color Slide
July 7th, 2008 in flash without flash | 4 Comments
Since Mootools 1.2 has been released, none of my Flash without Flash stuff works with it. So here’s an updated script for the original color slide tutorial, plus a bonus enhancement.
The HTML
<ul id="nav"> <li><a href="#">These aren't images!</a></li> <li><a href="#">And they aren't made with flash!</a></li> <li><a href="#">It's all dynamic javascript!</a></li> </ul>
The CSS
#nav { margin:1em; list-style:none; } #nav a { font-size:24px; font-weight:bold; color:#f60; text-decoration:none; position:relative; } #nav a span.hover { color:#06f; position:absolute; top:0; left:0; cursor:pointer; }
The Javascript
window.addEvent('load', function () { $$("#nav li a").each( function (el) { var height = el.offsetHeight; var width = el.offsetWidth; var mid = (width / 2).round(); var hover = new Element('span', { "class": 'hover', "styles": { "clip": [0,mid,height,mid] }, "text": el.get('text'), "tween": { "link": 'cancel', "duration": 600, "transition": 'quint:out' } }).inject(el, 'inside'); el.addEvents({ "mouseover": function () { hover.tween('clip', [0, width, height, 0].join(' ')); }, "mouseout": function () { hover.tween('clip', [0, mid, height, mid].join(' ')); } }); }); });

Hi, I'm Chris, a passionate freelance web developer. My languages of choice are PHP and JavaScript, and that's what you'll mostly find in my blog. You'll also find updates about 