简体   繁体   中英

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. This is my code for the 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:

<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.

Example fiddle: 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/ . If this doesn't work then consider using jQuery UI tooltip instead. It's used by a lot more people, it easy and has plenty of support. http://jqueryui.com/tooltip/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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