简体   繁体   English

如何同时使用jQuery和span类?

[英]How to use both jQuery and span class?

I want the link number to change to a dot on hover and for a message to appear on hover and I've done it using jQuery and a spam class but I can't make them go together, only one will work at a time. 我希望链接号在悬停时更改为点,并在悬停时显示一条消息,我已经使用jQuery和垃圾邮件类将其完成,但我无法将它们组合在一起,一次只能工作一次。 This is my code for the jQuery: 这是我的jQuery代码:

(function($){
  $(document).ready(function(){
    $("a[title]").style_my_tooltips({
      tip_follows_cursor:false, 
      tip_delay_time:90, 
      tip_fade_speed:600, 
      attribute:"title"
    });
  });
})(jQuery);

The code for the title appearance: 标题外观的代码:

#s-m-t-tooltip {
max-width:300px;
padding:6px 6px 6px 6px;
margin:20px 0px 0px 20px;
background: #fff;
border:1px solid #000;
font-family:arial;
font-size:10px;
letter-spacing:0px;
text-transform:uppercase;
color:#000;
z-index:999999999999999999999999999999999999;
}

the cove for the text change on hover: 悬停文本更改的小海湾:

.navi .dot { display: none; }
.navi:hover .link { display: none; }
.navi:hover .dot { display: inline; }

and the HTML: 和HTML:

<span class="navi">
<span class="link">
<a href="" title="Online Services">1</a></span>
<span class="dot">&bull;</span></span> 

My problem is that the text changes from the one to the • but the message doesn't appear on hover, and if I make it so no text changes, the message appears so I know it isn't a problem with the message coding. 我的问题是文本从一个更改为•,但是该消息没有悬停显示,并且如果我没有做任何更改,该消息就会出现,因此我知道这与消息编码无关。

You need to put the title attribute on the "dot" span. 您需要将title属性放在“点”跨度上。

Example fiddle: http://jsfiddle.net/ZBdRu/ 小提琴示例: http : //jsfiddle.net/ZBdRu/

<span class="navi">
<span class="link">
<a href="" title="Online Services">1</a></span>
<span class="dot" title="Online Services">&bull;</span></span>

EDIT: As jsFiddle doesnt have your plugin module as part of it I've redone the fiddle for you to try with the plugin on your dev system http://jsfiddle.net/ZBdRu/1/ . 编辑:由于jsFiddle没有将您的插件模块作为其一部分,所以我已经重做了小提琴,让您尝试在您的开发系统http://jsfiddle.net/ZBdRu/1/上使用该插件。 If this doesn't work then consider using jQuery UI tooltip instead. 如果这不起作用,请考虑使用jQuery UI工具提示。 It's used by a lot more people, it easy and has plenty of support. 它被更多的人使用,它很容易并且有很多支持。 http://jqueryui.com/tooltip/ http://jqueryui.com/tooltip/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM