Results 1 to 7 of 7

Thread: DHTML Tooltip - Overlap with normal element

  1. #1
    Join Date
    May 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Tooltip - Overlap with normal element

    hi,
    i combined the "dhtml tooltip" with an image preview on mouse-over

    now form elements like select-boxes overlap the preview.. this is just in IE..
    the z-index of the div is at 100... the form is in no layer.

    what could help?

    thx so far!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Hide[1] the form elements or use an iframe shim[2] to cover them. Do this for IE only and only when the tool tip is visible.

    Or, move the form element in your layout so that it can never conflict with a tip.

    This is an IE only bug and hopefully will be fixed in IE7.

    [1] Create and add code to the script that will set the style.visibility='hidden' for the form element(s) while the tool tip is displayed and return that to 'visible' when the tip disappears.

    [2] Create and add code to the script that, using z-index style, places a blank iframe of the same dimensions underneath each tool tip while it is displayed and removes said iframe when the tip disappears.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    54
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    How would this be done? I'm having the same difficulties.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    For the hiding method see:

    http://www.dynamicdrive.com/forums/s...ad.php?p=11343

    particularly post#6. I'm not aware of anyone working out the details of the iframe shim method for these scripts (there are two versions of DHTML tool tip on DD here). I'll have a look into it but, no promises.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I had a version of the iframe shim laying around for another script. Here it is for DHTML tool tip:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    
    #dhtmltooltip{
    position: absolute;
    width: 150px;
    border: 2px solid black;
    padding: 2px;
    background-color: lightyellow;
    visibility: hidden;
    z-index: 100;
    /*Remove below line to remove shadow. Below line should always appear last within this CSS*/
    filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
    }
    
    </style>
    <!--[if gte IE 5.5]>
    <!--[if lte IE 6]>
    <iframe id="shim" src="" style="position:absolute;display:none;filter:progid:DXImageTransform.Microsoft.Chroma(Color='#ffffff');" scrolling="no" frameborder="0"></iframe>
    <![endif]-->
    <![endif]-->
    
    <script type="text/javascript">
    function shimit(obj){
    if (typeof shim=='undefined')
    return;
    var shimobj=document.getElementById('shim').style;
    shimobj.height=obj.offsetHeight+'px'
    shimobj.width=obj.offsetWidth+'px'
    var obj=obj.style
    shimobj.left=obj.left
    shimobj.top=obj.top
    shimobj.zIndex=99
    shimobj.display='block'
    }
    
    function noshim(){
    if (typeof shim=='undefined')
    return;
    document.getElementById('shim').style.display='none';
    }
    </script>
    
    </head>
    <body>
    <div id="dhtmltooltip"></div>
    
    <script type="text/javascript">
    
    /***********************************************
    * Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    * Modified in http://www.dynamicdrive.com/forums to deal with IE
    * select bug in IE5.5 through IE6 by jscheuer1
    ***********************************************/
    
    var offsetxpoint=-60 //Customize x offset of tooltip
    var offsetypoint=20 //Customize y offset of tooltip
    var ie=document.all
    var ns6=document.getElementById && !document.all
    var enabletip=false
    if (ie||ns6)
    var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
    
    function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function ddrivetip(thetext, thecolor, thewidth){
    if (ns6||ie){
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    tipobj.innerHTML=thetext
    enabletip=true
    return false
    }
    }
    
    function positiontip(e){
    if (enabletip){
    var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
    var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
    var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
    
    var leftedge=(offsetxpoint<0)? offsetxpoint*(-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=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
    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+offsetxpoint+"px"
    
    //same concept with the vertical position
    if (bottomedge<tipobj.offsetHeight)
    tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
    else
    tipobj.style.top=curY+offsetypoint+"px"
    tipobj.style.visibility="visible"
    shimit(tipobj);
    }
    }
    
    function hideddrivetip(){
    if (ns6||ie){
    enabletip=false
    tipobj.style.visibility="hidden"
    noshim();
    tipobj.style.left="-1000px"
    tipobj.style.backgroundColor=''
    tipobj.style.width=''
    }
    }
    
    document.onmousemove=positiontip
    
    </script>
    <a href="http://www.yahoo.com" onMouseover="ddrivetip('Visit Yahoo.com')";
     onMouseout="hideddrivetip()">Search Engine</a><br>&nbsp;<br>
    <select>
    <option>fgbjfgbha
    <option>fgbjfgbha
    <option>fgbjfgbha
    <option>fgbjfgbha
    </select>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi,
    how can i put the tooltip into a layer?

    would that help?

    thx

  7. #7
    Join Date
    May 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh, thx for your reply.. i'll try that..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •