jquerysettimeoutjquery-eventsjquery-toolsjquery-ui-tooltip

jQuery tools tooltip doesn't appear in first try after hide()


I've used tooltip for a <div>.
It will hide() after couple of seconds.
If I'll mouse over it's trigger after it.
For the first time it will not appear.
Only after I move the mouse over it the second time it will appear.
I used onShow event for binding and used window.setTimeOut.

Is it a problem in the tooltip or in jQuery?

Something like this:

$(document).ready(function() {
    x = $("button").tooltip({
        api: true,
        position: "center right",
        onShow: function() {
            var hid = function() {
                x.getTip().hide();
            };
            window.setTimeout(hid, 2000);
        }});
    x.show();
    });

demo


Solution

  • well, I've fixed it: answer here:

    $(document).ready(function() {
        x = $("button").tooltip({
            api: true,
            **effect:"fade"**,
            position: "center right",
            onShow: function() {
                var hid = function() {
                    **x.hide();**
                };
                window.setTimeout(hid, 2000);
            }});
        x.show();
        });
    

    http://jsfiddle.net/vKa5Z/5/