jquery bind an event to a class, or something to the same effect?

Posted by mna on Stack Overflow See other posts from Stack Overflow or by mna
Published on 2011-01-13T23:45:40Z Indexed on 2011/01/13 23:53 UTC
Read the original article Hit count: 150

Filed under:
|

hi, I'd like to bind an event to a class, or any alternative to the redundant code I posted below. Any ideas?

thanks, mna

(function(){
    $( "button", "body" ).button();
    var submenu=false;

    $( "#about" ).click(function() {
    $( "#content" ).fadeOut(1000);
    $( "#content" ).load('about.html');
    $( "#content" ).fadeIn(1000);
     });

    $( "#community" ).click(function() {
    $( "#content" ).fadeOut(1000);
     $( "#content" ).load('community.html');
     $( "#content" ).fadeIn(1000);
     });

     $( "#store" ).click(function() {
     $( "#content" ).fadeOut(1000);
     $( "#content" ).load('store.html');
     $( "#content" ).fadeIn(1000);
     });

    $( "#projects" ).click(function() {
    $( "#content" ).fadeOut(1000);
    $( "#content" ).load('projects.html');
    $( "#content" ).fadeIn(1000);
    });
});

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery