开发者

What could cause conflict with Tipsy's focus trigger?

开发者 https://www.devze.com 2023-02-18 17:14 出处:网络
I\'m using the Tipsy jquery plugin and the focus triggers acts the same way as the hover trigger. Tipsy stops displaying once my mouse is off an input field even though the field is still focused. Wha

I'm using the Tipsy jquery plugin and the focus triggers acts the same way as the hover trigger. Tipsy stops displaying once my mouse is off an input field even though the field is still focused. What could cause this开发者_StackOverflow中文版 issue? Based on this jQuery tipsy plugin. On focus trigger not working. It's not the actual plugin that's causing the issue

Here's the page I'm testing it on

http://uploads.glumbo.com/?op=registration


You will want to update Tipsy file you are using. The one you are using right now is significantly different than the latest version of Tipsy.


As Haochi says, you need to update your Tipsy version to 1.0.0a. Then use the following code to add both hover and focus to your tipsy tooltips (demo):

$('.registerform [title]')
    .tipsy({
        trigger: 'manual', // manual stops binding of any internal tipsy events
        gravity: 'w',
        fade: true
    })
    .bind('focus mouseenter', function(e) {
        // flag indicating the input has focus
        if (e.type === 'focus') {
            $(this).addClass('hasFocus');
        }
        $(this).tipsy("show");
    })
    .bind('blur mouseleave', function(e) {
        // if mouseleave is triggered but the input has focus, ignore it
        if (!$(this).is('.hasFocus') || e.type === 'blur') {
            $(this).removeClass('hasFocus').tipsy("hide");
        }
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号