treehouse : what would you like to learn today?
Web Design Web Development iOS Development

jQuery fadeIn / fadeOut [Solved]

  • Hi,
    I'm a beginner with jQuery, here is my script :
    $(function() {
    $('#box').mouseover(function() {
    $('a').fadeIn('fast');
    });
    $('#box').mouseout(function() {
    $('a').fadeOut('fast');
    });

    $('a').click(function() {
    $('#box').fadeOut('slow');
    });
    });


    The HTML :

    <div id=\"box\">
    <a href=\"#\">Delete</a>
    </div>


    The problem is that whenever I hover over the "Delete" link, it fadeOut / fadeIn and I don't want that. Any suggestion ?

    Here is the link to the exemple http://mismouc.free.fr/jQuery/
  • Try it using the hover function.

    $(function() {
    $('#box').hover(function() {
    $('a').fadeIn('fast');
    },
    function() {
    $('a').fadeOut('fast');
    });

    $('a').click(function() {
    $('#box').fadeOut('slow');
    });
    });
  • It works perfectly !
    Thank you very much !