jQuery醉意的插件。在焦点触发不工作 [英] jQuery tipsy plugin. On focus trigger not working

查看:131
本文介绍了jQuery醉意的插件。在焦点触发不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过jQuery工具提示插件过滤我的方式,并发现醉意。它被GitHub使用,这是我基于我的决定的大部分。我真的很喜欢它,它使用起来非常简单。



虽然我有问题。我需要工具提示淡入焦点,而不是悬停。它目前的工作,但只有悬停。这里是我目前的代码:
$ b $ pre $ $'code $('input.tip')。tipsy({trigger:'focus',gravity: 'w',fade:true});

有或没有触发器:'hover',没有区别。我仔细阅读了文档,所以它是正确的代码。

这不是关于HTML / CSS,我知道这是事实。因为它已经工作,只是没有焦点。



我正在使用jQuery v1.4.4。



将不胜感激,谢谢。



资源: http://onehackoranother.com/projects/jquery/tipsy/

解决方案

这个插件适用于我简单的测试案例基于您提供的代码。你确定在你的页面的附加代码中没有什么可能导致这个错误?



我的简单的测试用例从github中抽取插件。 jsfiddle.net添加了一些额外的东西,但重要的一点可以简化为下面的HTML,当我测试它的作品:

pre $ <!DOCTYPE html>
< html>
< head>
< script type ='text / javascript'src ='http://code.jquery.com/jquery-1.4.4.min.js'>< / script>
< script type ='text / javascript'src =https://github.com/jaz303/tipsy/raw/fa497c144ad7d14126a808f4c18a9ba22f2df70f/src/javascripts/jquery.tipsy.js>< / script>
< script type ='text / javascript'>
$(function(){
$('input.focustip')。tipsy({trigger:'focus',gravity:'w',fade:true});
$ input.hovertip)。tipsy({trigger:'hover',gravity:'w',fade:true});
});
< / script>
< / head>
< body>
< p>< a href =http://stackoverflow.com/q/4258519/445073的测试案例> stackoverflow问题< / a>。< / p>
< p>焦点提示:< input class =focustiptitle =focus>< / input>< / p>
< p>悬停提示:< input class =hovertiptitle =hover>< / input>< / p>
< / body>
< / html>

我在Firefox 3.6和Chrome 8上进行了测试。

I have been filtering my way through jQuery tooltip plugins and have found tipsy. It is used by GitHub, that was what I based most of my decision on. I really like it and it is really easy to use.

I am having a problem with it though. I need the tooltip to fade in on focus, not hover. It currently works but only on hover. Here is my current code:

$('input.tip').tipsy({trigger: 'focus', gravity: 'w', fade: true});

With or without trigger: 'hover', makes no difference. I read the docs thoroughly so it is correct code.

It is not to do with the HTML/CSS, I know that for a fact. Because it already works, just not on focus.

I am using jQuery v1.4.4.

Any suggestions would be much appreciated, thanks.

Resource: http://onehackoranother.com/projects/jquery/tipsy/

解决方案

The plugin works for me in a simple test case based on the code you provide. Are you sure there is nothing in the additional code of your page that could be causing this to go wrong?

My simple test case pulls in the tipsy plugin from github. jsfiddle.net adds some extra stuff, but the important bits can be reduced to the following HTML which works when I test it:

<!DOCTYPE html> 
<html> 
<head> 
  <script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script> 
  <script type='text/javascript' src="https://github.com/jaz303/tipsy/raw/fa497c144ad7d14126a808f4c18a9ba22f2df70f/src/javascripts/jquery.tipsy.js"></script> 
  <script type='text/javascript'> 
  $(function(){
      $('input.focustip').tipsy({trigger: 'focus', gravity: 'w', fade: true});
      $('input.hovertip').tipsy({trigger: 'hover', gravity: 'w', fade: true});
  });
  </script> 
</head> 
<body> 
  <p>Test case for <a href="http://stackoverflow.com/q/4258519/445073">stackoverflow question</a>.</p> 
<p>Focus tip: <input class="focustip" title="focus"></input></p> 
<p>Hover tip: <input class="hovertip" title="hover"></input></p> 
</body> 
</html> 

I tested in Firefox 3.6 and Chrome 8, both on Linux.

这篇关于jQuery醉意的插件。在焦点触发不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆