Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

positioning jQuery tooltip

I'm trying to customise the positioning of my tooltips, using jQuery UI Tooltip and this code:

$(".karma").tooltip({
  position: {
    my: "center bottom",
    at: "right top"
  }
});

But whatever I do to "my" and "at" nothing changes. What am I doing wrong?

Here is the link to the jQuery Tooltip API position section

like image 759
Jeff Pole Avatar asked Mar 07 '13 18:03

Jeff Pole


People also ask

How to trigger tooltip in jQuery?

$("#myElement"). tooltip();

How do I change the tooltip position in CSS?

The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" . CSS: The tooltip class use position:relative , which is needed to position the tooltip text ( position:absolute ). Note: See examples below on how to position the tooltip. The tooltiptext class holds the actual tooltip text.


2 Answers

There is nothing wrong with your code. However, without seeing your HTML, it is hard to say why it isn't working.

Make sure you have loaded jQueryUI script: here. Also make to wrap your code with $(document).ready(). Let me know if you have any other questions.

DEMO: http://jsfiddle.net/dirtyd77/SLGdE/16/

like image 122
Dom Avatar answered Oct 01 '22 15:10

Dom


If you got here because your positioning addition wasn't working (e.g. at: "right + 10"), then the solution is to remove any spaces around the operator.

Change at: "right + 10" to at: "right+10", and it should work.

like image 25
Ben Avatar answered Oct 01 '22 14:10

Ben