I found a tutorial on a tooltip and I tried to copy it without looking at it. After I did that I found some differences in my code and the tutorial. So I fixed it, but still it doesn't show up.
http://www.jsfiddle.net/8RTqC/
Nevermind, I found the problem.
Changed
tip = $(this).find(开发者_StackOverflow'.tooltip');
for
tip = $('.tooltip');
and it worked
Your selector is wrong:
tip = $(this).find('.tooltip');
This looks for an element with class 'tooltip' within your anchor. Just use:
var tip = $('.tooltip');
To keep it per link, you need to replace this:
$(this).find('.tooltip')
With a method that looks for the tooltip a a sibling, instead of inside the <a>
, like this:
$(this).next('.tooltip')
You can test it out here.
You are better off not reinventing the wheel. Try this:
http://flowplayer.org/tools/tooltip/index.html
精彩评论