Jump to content

Tooltip overlaps on background text


sandy1028

Recommended Posts

#bubble_tooltip{
        width:400px;
        position:absolute;
        display:none;
        top:50px;
}
#bubble_tooltip .bubble_top{
        background-image: url('../bubb_top.gif');
        background-repeat:no-repeat;
        height:56px;
        top:10px;
}
#bubble_tooltip .bubble_middle{
        background-image: url('../bubb_middle.gif');
        background-repeat:repeat-y;
          padding-left:8px;
        padding-right:7px;
}
#bubble_tooltip .bubble_middle span{
        position:relative;
        font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
        font-size:15px;

}
#bubble_tooltip .bubble_bottom{
        background-image: url('../bubb_bottom.gif');
        background-repeat:no-repeat;
        background-repeat:no-repeat;
        height:90px;
        position:relative;
      }

<script>
function showToolTip(e,text){
        if(document.all)e = event;

        var obj = document.getElementById('bubble_tooltip');
        var obj2 = document.getElementById('bubble_tooltip_content');
        obj2.innerHTML = text;
        obj.style.display = 'block';
        var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
       // if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
        var leftPos = e.clientX - 70;
        if(leftPos<0)leftPos = 0;
        obj.style.left = leftPos + 'px';
        obj.style.top = e.clientY + 270- obj.offsetHeight -1 + st + 'px';
}

function hideToolTip()
{
        document.getElementById('bubble_tooltip').style.display = 'none';

}
</script>

<html>
<body>
<div id="bubble_tooltip">
        <div class="bubble_top"><span></span></div>
        <div class="bubble_middle"><span id="bubble_tooltip_content"></span></div>
        <div class="bubble_bottom"></div>
</div>

</body>
</html>

 

 

The tooltip overlaps on the text in the background. how to avoid it.

 

How to adjust the position depending on the textual information in tooltip.

 

Tooltip increases when amount of text inside it increases.

 

Problem is when i set the position in javascript to 270 if the amount of text is less the tooltip is moves down to 270px.

 

 

Tooltip bubble_middle increases as the amount of text increases..

 

 

 

Please help me how can i solve these problem

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/75325-tooltip-overlaps-on-background-text/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.