Jquery tooltip that stays open on hover

Deadly 提交于 2019-12-25 12:38:52

问题


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:


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.



来源:https://stackoverflow.com/questions/10085773/jquery-tooltip-that-stays-open-on-hover

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!