2011-08-08 3 views

Répondre

4

HTML:

<span class="tooltip_display">Tooltip</span> 
<div class="ttip"> 
    <div class="contents">Here goes contents...</div> 
    <span class="note">(click here to close the box)</span> 
</div> 

CSS:

.ttip { 
    position: absolute; 
    width: 350px; 
    height: 100px; 
    color: #fff; 
    padding: 20px; 
    -webkit-box-shadow: 0 1px 2px #303030; 
    -moz-box-shadow: 0 1px 2px #303030; 
    box-shadow: 0 1px 2px #303030; 
    border-radius: 8px 8px 8px 8px; 
    -moz-border-radius: 8px 8px 8px 8px; 
    -webkit-border-radius: 8px 8px 8px 8px; 
    -o-border-radius: 8px 8px 8px 8px; 
    background-image:-moz-linear-gradient(top, #F45000, #FF8000); 
    background-image: -webkit-gradient(linear, left top, left bottom, from(#F45000), to(#FF8000)); 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F45000', endColorstr='#FF8000', GradientType=0); 
    display: none 
} 
.contents { 
    font-size: 15px; 
    font-weight:bold 
} 
.note { 
    font-size: 13px; 
    text-align:center; 
    display:block; 
    width: 100% 
} 

JQUERY:

$('.tooltip_display').click(function() { 
    $('.ttip').css({ 
     left: '20px', 
     top: '50px' 
    }).show(500) 
}); 

$('.note').live('click', 
function() { 
    $('.ttip').hide(500); 
}); 

JSFIDDLE

+0

@French Boy Je donne une démonstration simple. mais vous pouvez trouver plus mieux de la source donnée ci-dessous. – thecodeparadox

+0

Beau travail. J'ai bidouillé pour vous [ici] (http://jsfiddle.net/kkL5B/) – anu

+0

Écrivez votre réponse pour ajouter le code pour cacher l'info-bulle – anu