hovertips at the edge of non-fixed width

alpapan - June 29, 2008 - 23:28
Project:Hovertips and Clicktips
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Great module but I have the problem when I use the tooltip (hovertip) on a word that is on the edge of a not fixed width theme. The hovertip will create a box expanding the width but I can scroll to see as the hovertip will disappear.

Is there a way to automatically detect if the width would change and if that happens then position it somewhere else? (see http://www.butterflybase.org for what I'm trying to do (they use yahoo.dom.event) - hovering over the menu creates a hovertip orientated properly. )

many thanks
a

#1

Dave Cohen - July 1, 2008 - 22:01
Category:bug report» feature request

I'd welcome a patch that did something like that. Or that made a hovertip slide into view after it appears. But offhand I don't know exactly how to do that.

#2

alpapan - July 1, 2008 - 23:08

I found this, I don't know if it can help (i can't javascript to save my life...). It's from
http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip2.htm

Sorry I can't provide a patch myself...

<script type="text/javascript">
..
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"

else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}
//same concept with the vertical position

..

 
 

Drupal is a registered trademark of Dries Buytaert.