101010
101010

Reputation: 15716

jQuery Tooltips seem to ignore the delay configuration option

I'm trying to display a tooltip on rollover and use the delay option to slow down the fadeOut.

I'm trying to use the delay parameter, which is leaner code. (The other way to do this is to use fadeOut, which ends up using a lot of code) but delay doesn't seem to work.

How do we make the delay parameter work?

<!DOCTYPE html>
<html>
<head>

    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.js"></script>

    <script language="javascript">
        $(window).load(function () {

            $("#rollover").tooltip({
                delay: { show: 0, hide: 3000 },
                items: "#rollover",
                content: "<a href='http://www.google.com'>You can't click this because it goes away too fast</a>"
            });

        });

    </script>
</head>
<body>

    <div>
    (<a href="" id="rollover">?</a>)
    </div>

</body>

</html>

Here it is using the fadeOut code. See the length of code difference?

    $("#rollover").tooltip({
        items: "#rollover",
        content: "<a href='http://www.google.com'>You can't click this because it goes away too fast</a>",
        close: function (event, ui) {
            ui.tooltip.hover(
            function () {
                $(this).stop(true).fadeTo(400, 1);
            },
            function () {
                $(this).fadeOut("400", function () {
                    $(this).remove();
                })
            });
        }
    });

Upvotes: 0

Views: 380

Answers (1)

101010
101010

Reputation: 15716

The commenter answered this, but won't post it. So I'm posting it (I waited a month and a half before doing this)

$("#rollover").tooltip({
                show: 0,
                hide: { delay: 3000 },
                items: "#rollover",
                content: "<a href='http://www.google.com'>You can't click this because it goes away too fast</a>"
            });

Upvotes: 2

Related Questions