2011-03-19 74 views
1

我正在使用Tipsy jquery插件,焦点触发器的作用方式与悬停触发器相同。即使字段仍然集中,即使鼠标离开输入字段,Tipsy也会停止显示。什么可能导致这个问题?基于此jQuery tipsy plugin. On focus trigger not working。这不是造成问题的什么可能会导致与Tipsy的焦点触发器发生冲突?

实际插件下面是我测试在页面上

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

+0

代码.... Coooooode .... COoOoOoOoOoODE !!!!或者至少一个jFiddle展示。 – 2011-03-19 23:12:18

+0

我正在尝试http://uploads.glumbo.com/?op=registration – 2011-03-19 23:15:00

+0

您的链接不起作用!请不要在上传网站上与我们分享文件。首选方法是使用http://jsfiddle.net/,然后使用dropbox(http://www.dropbox.com)。 – Mottie 2011-03-20 04:03:45

回答

1

正如Haochi所说,你需要更新你的Tipsy版本到1.0.0a。然后使用下面的代码同时添加悬停和集中到你的醉意工具提示(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

'Tipsy'不适用于您提供的演示链接。 – 2014-02-26 10:21:35

+1

@MohitBhansali这是因为演示链接到一个github原始文件,它不再工作。试试[这个演示](http://jsfiddle.net/Mottie/fpfCB/103/) – Mottie 2014-02-26 13:30:14

+0

谢谢@Mottie。它的工作。 – 2014-02-27 03:12:48

相关问题