jQuery Tooltips parece ignorar la opción de configuración de retraso

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();
                })
            });
        }
    });

preguntado el 24 de mayo de 14 a las 16:05

It's not a duplicate because the other ones do not make use of the delay configuration variable. They are using fadeout delay, which is not the same thing. I've updated my question to make this more specific. -

Ok, where did you see the 'delay' option documented in the way that you've used it? Using 'delay' as it's written in the docs works fine: jsfiddle.net/258P4 -

You've answered my question! Thanks! See? Not a dupe. Post your code as an answer and I'll mark it as answered. -

It's pretty similar to both: stackoverflow.com/questions/14388147/… e stackoverflow.com/questions/16499249/…. I'd recommend using the fadeout code as it's more user friendly. Either way, it's a pretty localised issue (passing options that don't exist) so I don't think me posting an answer would help anyone. Glad it fixed your issue though! -

1 Respuestas

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>"
            });

Respondido 14 Jul 14, 14:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.