Really like that interface Andy. My only beef is that the top of the logo
gets cut off when the page slides up. More of a design preference on my
part I guess. Super cool UI.
-- Josh
----- Original Message -----
From: "Scott Sauyet" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Friday, September 07, 2007 8:15 AM
Subject: [jQuery] Re: My freelance site, a question about redundant code...
Andy Matthews wrote:
http://www.commadelimited.com/
Very pretty! Ooh, shiny toys! ;-)
There's a code block in there that I'm not happy with. It works, but it's
redundant and ugly. I'm wondering if you guys can look at it and let me
know where I could improve it.
The code can be found in http://www.commadelimited.com/includes/site.js
. It's the block labeled
The first thing that comes to mind is that the following could be made
into a function, saving some duplication.
$contentContainer.animate({
height: 650
},"slow", function(){
$('#' + target).fadeIn();
});
I don't have enough time to test this right now, but I also think that
your .each loop is unnecessary. You could simply do
var $contentContainer = $('#contentContainer'); // out of loop!
$('#navbar a').click(function() {
var target = $(this).attr('href');
if ($contentContainer.css('height') == '201px') {
// ...
});
That should save a little bit.
Good luck,
-- Scott