Grow your CSS skills. Land your dream job.

Simplifying jQuery Mess

  • # May 3, 2011 at 12:35 pm

    Hey Everyone!

    Let me introduce my new project:

    http://7evenmgt.com

    I use some jquery code to make it look better , the code works really well, but I think I use to much lines to make it work…

    I’m not the expert on jQuery in fact I use what is logic to me … but I know there must be rules to make it better..

    this is the code I use:

    //animate
    $('a.tal').hide();
    $('div#pdf a').addClass('book');

    $('#mb_imageflowlist').hide();
    $('.mb_heading').fadeIn(800);
    $('#mb_imagelist li:gt(11)').hide();

    $('#mb_content_wrapper').animate({
    right:'0',
    opacity: "1"
    }, 800 );
    $('#supersized-loader').fadeIn();

    $('#mb_menu a, a.showhide').bind('click', function() {
    $("#mb_content_wrapper").animate({
    top:'0',
    right:'-830px',
    opacity: "1"
    }, 800 );
    $("#supersized-loader").fadeIn();
    });

    $('#mb_imagelist li img').bind('click', function() {
    $("ul.workedIn,.single_talent,a.return").fadeOut().delay(800);
    $('ul#mb_imagelist').fadeOut(1).delay(800);
    $('a.tal').delay(2).show();
    $('#mb_imageflowlist').show().animate({
    width: '500px',
    marginLeft: '0em'
    }, 800);
    });


    $('a.tal').bind('click', function() {
    $('#mb_imageflowlist').fadeOut(1).hide();
    $('ul#mb_imagelist').delay(500).fadeIn(800);
    $('a.tal').fadeOut(100).hide();
    $("ul.workedIn,.single_talent,a.return").delay(900).fadeIn();
    $("#supersized-loader").fadeIn().fadeOut();
    });

    if somebody could give me a lesson or maybe point me in the correct way , I will appreciate it very much.

    thanks!

    # May 3, 2011 at 2:10 pm

    .bind('click', function() { can just be written as .click(function() {

    # May 4, 2011 at 5:13 pm

    @DogsGhost oh yeah you’re sooo right. , In fact I don’t really know why I use .blind , was inertial I think so haha, thanks for the tip.

    # May 17, 2011 at 2:12 am

    well poject is open ,if someone want can give some feedback, (btw the jquery is still a mess).

    http://7evenmgt.com/

    thanks

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".