CSS
Код
span.tooltip{
background:rgba(0,0,0,0.95);
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
font-size:14px;
color:#FFF;
padding:5px 15px;
position:absolute;
z-index:1;
width:220px;
}
span.tooltip:before{
border:solid;
border-color:rgba(0,0,0,0.95) transparent;
border-width:0px 10px 10px;
top:-10px;
left:10%;
content:"";
position:absolute;
z-index:2;
}
JS
Код
function tooltip(ths){
var event=window.event.type||event;
$(ths).before('<span class="tooltip">'+$(ths).attr("tooltip")+'</span>');
if(event=="focus") $(ths).blur(function(){$("span.tooltip").remove();});
if(event=="mouseover") $(ths).mouseout(function(){$("span.tooltip").remove();});
$("span.tooltip").css({"top":($(ths).position().top+$(ths).outerHeight()+5)+"px","left":($(ths).position().left+10)+"px"});
};
Вызов
Код
<[tag] tooltip="[подсказка]" [onmouseover|focus]="tooltip(this);">Контент</[tag]>