Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 居中工具提示?_Html_Css_Tooltip_Centering - Fatal编程技术网

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>

区域{
显示:内联块;
}
$(函数(){
$(文档)。工具提示({位置:{
我的:“中底”,
在“中心顶端”,
}
});
});
  • 请使用iQuery的最新版本
  • 尝试以这种方式居中:

    $(".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,所以您是否尝试了