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

Reply via email to