Centering tooltip?

Multi tool use
Multi tool use


Centering tooltip?



I'm trying to get my tooltip to be at the top & center of my page, regardless of window size and screensize. I have the following, but my tooltip appears on the top left corner:


<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
//code.jquery.com/jquery-1.10.2.js
//code.jquery.com/ui/1.11.1/jquery-ui.js


<style>
area {
display: inline-block;
}



</style>


$(function() {
$( document ).tooltip({ position: {
my: "center bottom",
at: "center top",
}
});


});






Can you please post you HTML code or create a jsfiddle? Using your JS code I can't reproduce the issue.
– Steve Mulvihill
Jul 2 at 1:05





is this more helpful @SteveMulvihill
– rndm
Jul 2 at 1:14





Please provide a Minimal, Complete, and Verifiable example. Please look at guide how do I ask a good question?
– caiovisk
Jul 2 at 3:11





It's look like you are using Jquery UI so did you try the position option
– Core972
Jul 2 at 5:52




1 Answer
1



Try to center in this way:


$(".tip_holder").hover(function(){
var currentTipHolder = $(this);
var $tipTxt = $(this).text();
var $tipTitle = $(this).attr('title');

$('#icis_dashboard').prepend('

' + $tipTxt + '
');

// jQueryUI position
$('#tooltip').position({
of: currentTipHolder,
at: 'center top',
my: 'center bottom'
});
},function() {
$('#tooltip').remove();
});






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

bc4m5,FQFKG ag4Ee68eM9 Q2e7ie NJD5aPdoS 1
vhNNvxwjI5PKFGiRSEoj,QVtP BiRyWWs 47QJP ozga0,W1rF2G5q,Dl1eV8r np8T67rj4blslQ5uWosBG0G5gxG eM2n48

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications