7

I have this code to make appear a tooltip when a message box is "hovered". All message boxes are inside a div called chatbox.

$('.box').hover(function(){
     var htmltooltip = '<div id="info" class="shadow">';
     htmltooltip += '<h4>Label info</h4>';
     htmltooltip += '<img src="images/defaultphoto.gif"/>';
     htmltooltip += '</div>';
     $(this).append(htmltooltip).children('#info').hide().fadeIn(400).css('left', -150);
     }, function() {
         $('#info').remove();
     }
   );

This is my css code to the chatbox, box and tooltip called #info

#chatbox {

    position: absolute;
    overflow-y:auto; 
    top:40%;
    left:50%;
    background:#fff;
    height:80%;
    width:550px;
    border:3px solid black;
    }
.box{
    width:90%;
    height:auto;
    margin:5px 20px 0px 0px;
    border:3px solid #918750;
    float:left;
    cursor: pointer;
}
#info{
    position:absolute;
    display:block;
    background:#7F7777;
    width:300px;
    padding-bottom: 0.5em;
    z-index:25;


}

My problem is that the tooltip is cut off by the chatbox div when pass the limits of the chatbox. Here is a jsfiddle: http://jsfiddle.net/Ifalcao/k9Yrc/2/

The overflow rule in the chatbox div must exist, otherwise if I have many message boxes, they will pass the limit of the chatbox. (http://jsfiddle.net/Ifalcao/URBDE) I need the message boxes inside the chatbox but the tooltips of the message boxes outside the chatbox.

Thanks in advance.

Falcoa
  • 2,612
  • 1
  • 20
  • 30

2 Answers2

3

Remove the overflow-y:auto; rule from the #chatbox div and the tooltip is completely visible.

jsFiddle example

j08691
  • 204,283
  • 31
  • 260
  • 272
  • 3
    Sorry, the problem persists because I need the overflow in the chatbox, otherwise if I have more message boxes, they will pass the limit of the chatbox. (http://jsfiddle.net/Ifalcao/URBDE/) I need the message boxes inside the chatbox but the tooltips outside the chatbox. – Falcoa Apr 18 '13 at 21:16
0

add in tooltip css as overflow: visible;

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Rahul
  • 128
  • 1
  • 14