I have been working on a simple tool tip (see fiddle below), but am having some positioning problems. I would like the tip to appear centered and above the link that is clicked. At the moment the top left corner is positioned at the mouse click. I tried to offset this position by half of the tooltip but to no success.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
Check out the changes at http://jsfiddle.net/CBf4C/3/
You need to get the position of the clicked element (use
.position()
), get the dimensions of the tooltip with.outerWidth()
and.outerHeight()
and then calculate based on these..the actual code is
http://jsfiddle.net/CBf4C/15/ - see this.
See the changes I've made here: http://jsfiddle.net/CBf4C/9/