The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

On body click, hide search

  • # April 21, 2013 at 8:01 am


    Couldn’t I do something like this:

    $(‘.find’).click(function(event) {
    if ($.browser.msie) {
    else {

    It doesn’t seem to work but you get what I mean.

    # April 21, 2013 at 8:10 am

    sure you can do the sliding effects like that but keep in mind that since jquery 1.9 $.browser is removed.
    So be sure the version you are using is lower than 1.9.Also navigator.userAgent might help you

    actually not slide down but the animate function in my pen

    # April 21, 2013 at 8:27 am

    Hmm. The if/else statement isn’t working for some reason.

    # April 21, 2013 at 10:02 am

    You can maybe try

    if (navigator.appName == ‘Microsoft Internet Explorer’)

    tested on IE9 and IE10. `$.browser` is removed as @pixelgrid said, downgrading your jQuery just to get that back seems not like a valid option to me, though if you did… I’m puzzled why it wouldn’t work.

    # April 21, 2013 at 12:36 pm

    This thread morphed too quickly for me to be able to respond haha.

    My 2c: definitely don’t like the browser sniffing being discussed here, personally.

    Also, you don’t need `e.preventDefault();` on the `.find` click function because it’s not an anchor, so there’s no default functionality you need to override.

    # April 21, 2013 at 12:58 pm

    @TheDoc, I agree on browser sniffing but for this the worst thing that could happen is the input gets focused for future IE versions if they ever decide to go with Netscape as `navigator.appName` like other vendors do.

    # April 22, 2013 at 2:01 am

    Thanks, Gray for pointing that out. I’ll edit the code.

Viewing 7 posts - 16 through 22 (of 22 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed