Dus*_*lio 7 jquery jquery-ui positioning tooltip jquery-ui-tooltip
更新:仍在寻找可行的解决方案,但请查看下面的答案,它可能会帮助您或给您一个想法.它适用于特定的分辨率.
我正在使用jQuery UI工具提示插件,但我无法按照我想要的方式定位工具提示.
我希望它垂直居中于鼠标,但是位于相关元素的左侧.我相信我的措辞是正确的,但我会告诉你一张我的意思.
(这是应该做的)
http://prntscr.com/v2yqi
正如您在我的示例中所看到的,它垂直居中于元素本身,而不是鼠标.
如果它可以用鼠标移动(仅垂直跟踪),这将是完美的.不确定这个插件是否可以实现.我真的不了解他们的定位API.
这是一个JSFiddle.
$(function() {
$( document ).tooltip({
items: ".entry",
position: { my: "center", at: "left" },
content: function() {
var element = $( this );
if ( ( element.is( ".entry" ) ) ) {
return "<div class='hi'>This is a very nice entry! It's so pretty and I feel like I can touch it. This is just random filler text to give you the idea..</div>";
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
我非常感谢你能给我的任何见解.提前致谢.
通过添加自定义类,跟踪和位置结束使其工作:已修复:
使用Javascript:
$(function () {
$(document).tooltip({
items: ".entry",
position: {
my: "right bottom+50"
},
tooltipClass: "entry-tooltip-positioner",
track: true,
content: function () {
var element = $(this);
if ((element.is(".entry"))) {
return "<div class='hi'>This is a very nice entry! It's so pretty and I feel like I can touch it. This is just random filler text.</div>";
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
CSS:
.entry {
position: relative;
right: -200px;
width: 500px;
}
.entry-tooltip-positioner {
position: fixed !important;
left: -130px !important;
}
Run Code Online (Sandbox Code Playgroud)
和更新的JSFiddle
希望这有时可以帮助其他人.
| 归档时间: |
|
| 查看次数: |
35004 次 |
| 最近记录: |