Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How do I make a floating image appear at mouseover?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #34567
    Vaxfiend
    Member

    I have a client who loves this feature on Zappos.com – go to any product, and mouseover where there are color choices. A small image hovers there, with rounded corners and a transparent shadow, and she wants that effect. I’m having a heckuva time finding the script to make that happen.

    Any ideas? Thanks much for any leads!

    #88271
    Josh
    Member
    #88273
    Johnnyb
    Member

    Hey @Josh, I have a quick question about the jQuery you wrote. I’m just wondering why and when you should use function(e) and when you should just use function(). I know about passing variables into functions eg: function(i), and I understand that e is shorthand for event, but even after looking here: http://api.jquery.com/event.data/ I still don’t understand how I should use it.

    Maybe this should be a separate discussion, but just thought I’d ask it here as it featured in the code you wrote.

    Many thanks!

    #88275
    thomas
    Member

    @Johnnyb, unlike many languages, with JavaScript, you can pass any number of arguments to a function whether the function accepts them in its definition or not.

    In the case of the event parameter, you don’t need to capture it in the function’s definition unless you plan on using it (e.g. var el = e.target). In the example @Josh gave, the script would work fine with or without the “e” parameter. Now, if he needed to get some information from the event object, it would have been required.

    #88469
    Vaxfiend
    Member

    Many thanks on the feedback! I’ll let you know how it turns out…I’m still pretty new to JScript and such.

    #89443
    Josh
    Member

    I’m just passing the event parameter because it’s a habit of mine. It’s not needed.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.