Grow your CSS skills. Land your dream job.

fadeToggle jquery

  • # June 8, 2012 at 8:18 am

    Hello!
    I’m trying to replicate the html5rocks “Search”.
    Here is my attempt: jsfiddle

    My question is what is the best practice to achieve this, how can I hide by default the searchbox div and how to append a “close” button with the same fading effect?
    Thanks!

    # June 8, 2012 at 9:53 am
    $("#searchbox").hide(); // Hide by default
    $("button").click(function() {
    $("#searchbox").fadeToggle("slow", "linear").find(".close").on("click", function() {
    $(this).parents("#searchbox").fadeOut("slow");
    return false;
    });
    });

    http://jsfiddle.net/tovic/KaeT7/1/

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

You must be logged in to reply to this topic.

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