如何激活cluetip事件准备好还是加载?
The clueTip plugin allows you to easily show a fancy tooltip when the user's mouse hovers over (or, optionally, clicks on) any element you designate in your script. If the element includes a title attribute, its text becomes the heading of the clueTip.
最佳答案
默认情况下,将鼠标悬停在应用了工具提示的元素上时会显示工具提示(请参阅 default options )
这可以更改为 click
事件,我将演示这两个事件。
这个想法是以编程方式触发事件 mouseenter
(没有真正的 hover 事件,而是 mouseenter 和 mouseleave)。
您可以使用 .trigger('mouseenter')
或 .mouseenter()
假设您想打开链接上的工具提示:
<a href="#" id="mylink" title="This is the title|The first the content.|In this case, the delimiter is a pipe">My link</a>
您将拥有以下 JavaScript:
$(document).ready(function() {
var $link = $('#mylink');
// first initialize the plugin
$link.cluetip({
splitTitle: '|'
});
// trigger the event
$link.mouseenter(); // or $link.click();
});
这是一个jsfiddle供你玩。
hover 的文档, .mouseenter() , .click()和 .trigger()
关于jQuery 线索提示激活,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8560518/