定位 jQuery 工具提示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15278630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
positioning jQuery tooltip
提问by Jeff Pole
I'm trying to customise the positioning of my tooltips, using jQuery UI Tooltipand this code:
我正在尝试使用jQuery UI Tooltip和以下代码自定义我的工具提示的位置:
$(".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
回答by Dom
There is nothing wrong with your code. However, without seeing your HTML, it is hard to say why it isn't working.
您的代码没有任何问题。但是,如果没有看到您的 HTML,很难说它为什么不起作用。
Make sure you have loaded jQueryUIscript: here. Also make to wrap your code with $(document).ready()
. Let me know if you have any other questions.
确保您已加载jQueryUI脚本:此处。还可以用$(document).ready()
. 如果您有任何其他问题,请告诉我。
回答by Ben
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.
如果您到达这里是因为您的定位添加不起作用(例如at: "right + 10"
),那么解决方案是删除操作员周围的任何空格。
Change at: "right + 10"
to at: "right+10"
, and it should work.
更改at: "right + 10"
为at: "right+10"
,它应该可以工作。
回答by Othman Dahbi-Skali
You can try this:
你可以试试这个:
my: "left-25 bottom",
at: "center"