Redirected from the UI group.

Dean wrote:
I have created a simple mouseover popup for a client. The client wants
the popup to stay visible with the mouse over both the trigger div as
well as the popup itself, and he wants a delay in the popup
disappearing on mouseout.

But when I use setTimeout to delay having the popup disappear, it
screws up the performance. The main thing is that I lose the dual/div
trigger of the popup. Only the original mouseover trigger div works to
trigger it. And sometimes there is flickering of the popup. The same
thing happened when I used a fadeout instead of setTimeout. But if I
get rid of both, it works fine.

You can see it as it is now at http://devel.indianchiefguides.com/en/germany

I think what you need to do is to cancel the timeout. This is untested, but should probably work:

    $(document).ready(function() {
        var timeout;
        $(".showinfo, #tinfo").hover(
            function () {
                if (timeout) clearTimeout(timeout);
                $("#tinfo").removeClass("hidden");
            },
            function(){
                timeout = setTimeout(
                    function() {
                        $("#tinfo").addClass("hidden");
                    },
                    350
                );
            }
        );
    });

But as someone else pointed out, the hoverIntent plug-in might be more robust.

Cheers,

  -- Scott

Reply via email to