Html 居中工具提示?
无论窗口大小和屏幕大小如何,我都试图让工具提示位于页面的顶部和中心。我有以下内容,但我的工具提示显示在左上角:Html 居中工具提示?,html,css,tooltip,centering,Html,Css,Tooltip,Centering,无论窗口大小和屏幕大小如何,我都试图让工具提示位于页面的顶部和中心。我有以下内容,但我的工具提示显示在左上角: <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<style>
area {
display: inline-block;
}
</style>
<script>
$(function() {
$( document ).tooltip({ position: {
my: "center bottom",
at: "center top",
}
});
});
</script>
区域{
显示:内联块;
}
$(函数(){
$(文档)。工具提示({位置:{
我的:“中底”,
在“中心顶端”,
}
});
});
$(".tip_holder").hover(function(){
var currentTipHolder = $(this);
var $tipTxt = $(this).text();
var $tipTitle = $(this).attr('title');
$('#icis_dashboard').prepend('<div id="tooltip">' + $tipTxt + '</div>');
// jQueryUI position
$('#tooltip').position({
of: currentTipHolder,
at: 'center top',
my: 'center bottom'
});
},function() {
$('#tooltip').remove();
});
$(“.tip_holder”).hover(函数(){
var currentTipHolder=$(此值);
var$tipTxt=$(this.text();
var$tipTitle=$(this.attr('title');
$('icis_dashboard')。前置('+$tipTxt+'');
//jQueryUI位置
$(“#工具提示”)。位置({
作者:currentTipHolder,
在‘中上’,
我的“中底”
});
},函数(){
$(“#工具提示”).remove();
});
您可以发布HTML代码或创建JSFIDLE吗?使用你的JS代码我无法重现这个问题。这对@SteveMulvihillPlease更有用吗?请提供一个。请看指南,看起来您正在使用Jquery UI,所以您是否尝试了