Jquery tooltip that stays open on hover

2019-09-08 11:17发布

I'm working with the following tooltip: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/

This works really well, but is there any support for implementing a tooltip that stays open on hover? Or a way to implement that?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-09-08 11:46

In the end, I opted to create a seperate jquery plugin for a 'sticky' tooltip.

Its basically the same as the usual tooltip, except it doesn't hide itself on mouseout.

If you want to see the implementation, check the 'createHelper' method in the original jquery tooltip and modify it as follows:

helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
            .bind('mouseleave', function () { hide(undefined, settings); })
            // add to document
            .appendTo(document.body)           
        // hide it at first
            .hide();

The above basically does: create a div parent, and keep it open until the user leaves the open tooltip.

查看更多
登录 后发表回答