hovertip position

milos1234 - March 9, 2009 - 19:09
Project:Hovertips and Clicktips
Version:6.x-1.x-dev
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi
Just wondering if there are options to change the hovertip postion? I would like it to appear above the hover element, or above mouseposition could be ok too.
Thanks!

#1

Dave Cohen - March 10, 2009 - 16:31

You should be able to control this with stylesheets. So you can customize it in your theme.

I don't know off hand exactly what to change, but a little investigation and you'll find it.

#2

milos1234 - March 11, 2009 - 22:24

@dave:
i dont think its just a css thing, it looks like the position of the hovertip is handled in the javascript. i read somewhere that someone was trying to do a similar thing but i have lost the link.

#3

Dave Cohen - March 12, 2009 - 13:04

It displays the hovertip relative to the mouse position, not the element's position. To change how far from the mouse, you can change the margin-left and margin-top on .hovertip and .hovertip_wrap0. (I think, haven't tested)

If you want to display relative to the target element, then you have to change some javascript. Write a replacement for hovertipTargetPrepare() which replaces calls to hovertipShowUnderMouse() with another function (you'll have to write) that displays them over the target. Then pass your function to hovertipActivate, instead of hovertipTargetPrepare. May sound complicated, but it's flexible.

#4

milos1234 - March 12, 2009 - 18:27

@Dave: thanks for the hints, but changing the css is not really a suitable fix, as my hovertips are dynamic, and of varied size throughout the site. ie the bottom of the hovertip needs to align with the mouse pointer.
(Using the Glossary module with hovertips).
I think i will have to go in and try and mong the javascript. :)

#5

tsi - May 21, 2009 - 18:20

I would love to know if this was successful and how it was done.
Thanks.

#6

immix_81 - October 8, 2009 - 14:25

dirty fix:

Line 64 hovertip.js: + var hovertipMouseW;
Line 69 hovertip.js: + hovertipMouseW = mouse[2];
Line 85 hovertip.js: + var width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
Line 111 hovertip.js: + return [xcoord, ycoord, width]; /* replace by this */
Line 235 hovertip.js: + 'left': ((hovertipMouseX+elwidth) > hovertipMouseW )?(hovertipMouseX-elwidth):hovertipMouseX + 'px'})  /* replace by this */

move the Hovertip to left of the Mouse Cursor if Hovertip cause Content to scroll.

 
 

Drupal is a registered trademark of Dries Buytaert.