0

目前,我正试图让Tipsy在悬停和点击时工作。但是我不知道这是否可能……使用其他工具会很不方便。

触发器:“手动”根本没有响应。有可能还是我真的必须使用其他工具?

这是代码的一部分:

function initialMouseEvents() { $('.channel-hover').each(function() {

    $('svg circle, svg path').tipsy({
        gravity: 's',
        trigger: 'manual',
        html: true,
        title: 'data-tipsy'
    });

    var dataChannel = $(this).attr('data-channel');

    $(this).bind('mouseover', function() {
        if ($(this).attr('data-channel').length) {
            effectVisualisation.highlightChannel(dataChannel);
            costVisualisation.highlightChannel(dataChannel);
        }
    }).bind('mouseout', function() {
        if ($(this).attr('data-channel').length) {
            effectVisualisation.normalizeChannel(dataChannel);
            costVisualisation.normalizeChannel(dataChannel);
        }
    });
});

}

4

2 回答 2

3

从您的代码中,我不确定您真正想要做什么,或者您的代码不完整。

请查看以下HTML:

<a id="example-1" href="#" original-title="Hello World">Hover over me</a>
<a id="test" href="#" onclick="$('#example-1')[0].setAttribute('original-title','you did it')">Update</a>

Javascript:

$(function() {
    $('#example-1').tipsy();
});

这就是你可能期待的。

编辑:对不起,我会包含发布 JsFiddle 链接的代码。

http://jsfiddle.net/c3DUx/

编辑2:

检查下面的小提琴,我希望你想要类似的东西。

http://jsfiddle.net/c3DUx/2/

于 2013-03-18T13:32:23.270 回答
0

可以为小费定义(手动/自定义)trigger

$(function() {
  $('#focus-example [title]').tipsy({trigger: 'focus'});
});

请参阅: http: //onehackoranother.com/projects/jquery/tipsy/#focus-example

尽管如此,Tipsy 似乎triggers默认不支持多个。但是可能可以手动绑定此行为 - 取决于您到底想要做什么。

到目前为止,您是否有一些示例代码?


编辑:只需找到有关(部分)此问题的类似线程:

$(".tipsy")
.live('mouseover',function(){
    $(this).tipsy("show");
})
.live("click",function() {
    $(this).tipsy("show");
})
.tipsy({
    gravity: gravity,
    html: true
});

jQuery Tipsy:简单的覆盖解决方案?

于 2013-03-18T12:29:18.720 回答