Simple OSX-like dock with jquery
1Aug2008 Filed under: dev Author: DanI have seen a lot of different approaches to do the OSX dock in javascript. I was convinced it could be easier.
Html:
-
<div id="dock">
-
<ul id="nav">
-
<li><a href="#"><img src="images/Mammooth_128×128.png" alt="Mammooth"/></a></li>
-
<li><a href="#"><img src="images/Mammoth_Back_128×128.png" alt="Mammooth"/></a></li>
-
</ul>
-
</div>
Javascript:
-
$(document).ready(function() {
-
$(‘#nav li’).hover(function() {
-
$(this).animate( { width: "128", height: "128" }, { queue: false, duration: 100 });
-
},
-
function() {
-
$(this).animate( { width: "50", height: "50" }, { queue: false, duration: 130 });
-
});
-
});
Se example at the dan labs…
Note this is done for proof of concept, performance is NOT good on old computers, anyways….
Enjoy.
thomas
March 31st, 2009 at 8:30 pm
Fantastic post. I am so tired of seeing people making things much more convoluted than they need to be. I made a very similar jquery plugin using very similar code for moving blocks. Well done.