Javascript Tooltip / Posts /

Can we use this tooltip when we have x and y cordinate of the element

1
Hello ,
Thanks for tooltip.
I am using ajax tooltip . My problem is that using jquery I found the x and f coordinates  of the elemnet and want to show the tooltip based on these coordinates .
Is it possible .
My code is

function showMapTrialToolip(x,y){
              tooltip.ajax(this, "<?php echo $this->url(array('controller'=>'trial', 'action'=>'show-trial-popup'), 'default', true);?>/trial_id/"+id,null, {position:4});
               
            }
I want that tooltip will apper at position x and y
Thanks

Piyush Goyal  11 years ago   viewed: 3690    

2 Answers

1
If you want to position the tooltip not relative to the triggering element, you should set position to be 4, 5, or 6:
4: center
5: top left
6: bottom right

If choosing 4, the x, y will be the offset to the center;
If choosing 5, the x, y will be the offset to the top left of the screen;
If choosing 6, the x, y will be the offset to the bottom right of the screen.
Milo   11 years ago
0

Yes, you can absolutely position tooltips using x/y coordinates. For your jQuery scenario, you'll need to: 1. Modify the tooltip initialization to use absolute positioning: ```javascript $('.element').tooltip({ position: { my: 'left top', at: 'left ' x ' top ' y, using: function(position, feedback) { $(this).css(position); } } }); ``` grade calculator

2. Or directly position the tooltip element: ```javascript function showMapTrialTooltip(x,y) { $('#tooltip').css({ 'position': 'absolute', 'left': x 'px', 'top': y 'px' }).show(); } ``` Would you like me to provide a complete working example with your AJAX implementation?

jeremyclark
  11 days ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: