[ Index ]
 

Code source de Seagull 0.6.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/js/ -> tooltip.js (source)

   1  
   2  
   3  /***********************************************
   4  * Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
   5  * This notice MUST stay intact for legal use
   6  * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
   7  ***********************************************/
   8  
   9  var offsetxpoint=-60 //Customize x offset of tooltip
  10  var offsetypoint=20 //Customize y offset of tooltip
  11  var ie=document.all
  12  var ns6=document.getElementById && !document.all
  13  var enabletip=false
  14  if (ie||ns6)
  15  var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  16  
  17  function ietruebody(){
  18  return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  19  }
  20  
  21  function ddrivetip(thetext, thecolor, thewidth){
  22  if (ns6||ie){
  23  if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
  24  if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
  25  tipobj.innerHTML=thetext
  26  enabletip=true
  27  return false
  28  }
  29  }
  30  
  31  function positiontip(e){
  32  if (enabletip){
  33  var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
  34  var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
  35  //Find out how close the mouse is to the corner of the window
  36  var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
  37  var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
  38  
  39  var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
  40  
  41  //if the horizontal distance isn't enough to accomodate the width of the context menu
  42  if (rightedge<tipobj.offsetWidth)
  43  //move the horizontal position of the menu to the left by it's width
  44  tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
  45  else if (curX<leftedge)
  46  tipobj.style.left="5px"
  47  else
  48  //position the horizontal position of the menu where the mouse is positioned
  49  tipobj.style.left=curX+offsetxpoint+"px"
  50  
  51  //same concept with the vertical position
  52  if (bottomedge<tipobj.offsetHeight)
  53  tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
  54  else
  55  tipobj.style.top=curY+offsetypoint+"px"
  56  tipobj.style.visibility="visible"
  57  }
  58  }
  59  
  60  function hideddrivetip(){
  61  if (ns6||ie){
  62  enabletip=false
  63  tipobj.style.visibility="hidden"
  64  tipobj.style.left="-1000px"
  65  tipobj.style.backgroundColor=''
  66  tipobj.style.width=''
  67  }
  68  }
  69  
  70  document.onmousemove=positiontip


Généré le : Fri Mar 30 01:27:52 2007 par Balluche grâce à PHPXref 0.7