Jump to content

Recommended Posts

Is there a way to make the hover text always appear next to the cursor even when scrolling down to the bottom of the page. It works ok at the top but when down the bottom the hover still displays at the top of the screen.

 

<html>

<head>
<style type="text/css">
<!--
#toolTipBox {
display: none;
padding: 5;
font-size: 20px;
border: #800000 solid 4px;
font-family: verdana;
position: absolute;
background: #ffd038;
colour: #008000;
}
-->
</style>
<script type="text/javascript">
<!--

var theObj="";

function toolTip(text,me)  {
  theObj=me;
  theObj.onmousemove=updatePos;
  document.getElementById('toolTipBox').innerHTML=text;
  document.getElementById('toolTipBox').style.display="block";
  window.onscroll=updatePos
  updatePos();
}

function updatePos()   {
  var ev=arguments[0]?arguments[0]:event;
  var x=ev.clientX;
  var y=ev.clientY;
  diffX=24;
  diffY=0;
  document.getElementById('toolTipBox').style.top = y-2+diffY+document.body.scrollTop+ "px";
document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+ "px";
theObj.onmouseout=hideMe;
}
function hideMe()  {
  document.getElementById('toolTipBox').style.display="none";
}
-->
</script>
</head>

<body>
<div align="center">
<span id ="toolTipBox" width="200"></span>
<img src="YOUR IMAGE HERE.jpg" border="0" onmouseover="toolTip(' PLACE TOOL TIP HERE', this)"></div>
</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/65332-hover-text/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.