Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Jquery - 1 Button - 2 Events?

Discussion in 'Website Design Forum:' started by Djsquid, Sep 6, 2011.

  1. Djsquid

    Djsquid New Member

    Hey Guys,

    is it possible to have 2 Jquery events run on the same button?

    for example I want my home page to fade to about 50% opacity when I click on #cat to open the navigation menu, but I also want to bring the opacity back to 100% if I were to click on #cat again? or any of the other nav buttons.

    I tried;

    $('#cat').click(function() {
    $('.homepage,').fadeTo(500, 0.5);
    return false;

    $('#cat').click(function() {
    $('.homepage,').fadeTo(500, 1.0);
    return false;

    It changes it to 50% but then instantly changes back to 100% so I'm thinking this is a little more complicated then I can do right now, so any help would be great!

    I have read about .bind and .one but I'm not sure.....still an amateur:D
  2. Sunburn

    Sunburn Active Member

  3. mrp2049

    mrp2049 Senior Member

    I knew the answer to that!!! I wanted to answer a coding question!
  4. Sunburn

    Sunburn Active Member

    Sorry to disappoint you Mr P.
  5. mrp2049

    mrp2049 Senior Member

    It's ok.

Share This Page