positioning jQuery tooltip

早过忘川 提交于 2019-11-30 04:28:03

问题


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


回答1:


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/




回答2:


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.




回答3:


You can try this:

    my: "left-25 bottom", 
    at: "center"


来源:https://stackoverflow.com/questions/15278630/positioning-jquery-tooltip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!