SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict greg76's Avatar
    Join Date
    Aug 2004
    Location
    Poland
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery, hover and multiple divs

    Hello,

    I have been trying to do some tooltips for a website and desperately wanted to learn something new and do that with jQuery.

    However, every time a mouse hovers over a tooltip, all hidden divs are shown, not just the one that supposed to.

    I know pretty much nothing about jQuery and cannot for love of God make the script to read proper div.

    Any help would be greatly appreciated!

    Here's my html:
    Code HTML4Strict:
    <div class="tip">
    <a href="#"></a>
        <div class="tooltip">
            <p>test test test<p>
        </div>
    </div>

    And here is the script that I have:
    Code JavaScript:
    $(document).ready(function()
    {
        $("div.tip").hover(
          function () {
            $('div.tooltip').fadeIn('fast');
          },
          function () {
            $('div.tooltip').fadeOut('fast');
          }
        );
    });

    Thank you!
    Regards,
    Greg

  2. #2
    SitePoint Addict
    Join Date
    Jul 2007
    Location
    San Jose, California
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $('div.tooltip').fadeIn('fast');

    try

    $(this).children('div.tooltip').fadein('fast');
    Last edited by baileylo; Oct 14, 2010 at 09:33. Reason: stupid js that wouldn't work.

  3. #3
    SitePoint Addict greg76's Avatar
    Join Date
    Aug 2004
    Location
    Poland
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Baileylo, that didn't work, however I have found the answer:

    $(document).ready(function()
    {
    $("div.tip").hover(
    function () {
    $('div.tooltip', this).fadeIn('fast');
    },
    function () {
    $('div.tooltip', this).fadeOut('fast');
    }
    );
    });




    thanks!
    G.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •