I have the following speech bubble or dialogue bubble that will tell me if the figure in which the mouse is located is a box or circle, the point is that the bubble comes out suddenly, as you might encourage it to come out more slowly and smoothed
$("area").hover(function() {
$(this).toggleClass('arriba').siblings().toggleClass('abajo')
})
function writeText(txt) {
if(txt == "Esto es un circulo"){
document.getElementById('bloque1').style.top = 0;
document.getElementById('bloque1').style.left =10;
document.getElementById("bloque1").style.display = "block";
document.getElementById("bloque1").innerHTML = txt;
}
else{
document.getElementById('bloque1').style.top = 0;
document.getElementById('bloque1').style.left =250;
document.getElementById("bloque1").style.display = "block";
document.getElementById("bloque1").innerHTML = txt;
}
}
function ondelete(){
var div = document.getElementById('bloque1');
if(div !== null){
while (div.hasChildNodes()){
div.removeChild(div.lastChild);
div.style.display = "none";
}
}
}
#figuras {
list-style: none;
}
.arriba {
transform: scale(1.2);
}
.abajo {
transform: scale(0.8);
}
.externo{
position:relative;}
div {
transition: 2s linear 1s;
}
.interno {
position:absolute;
top:0;
left:0;
padding: 10px;
width: 220px;
background: #6495ED; /* el color de fondo */
color: #FFF; /* el color del texto */
font-family: Arial, Sans-serif;
font-size: 12px;
padding: 20px 10px 10px 10px;
text-align: center;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
display: none;
}
.interno:after {
border: solid 10px transparent;
border-top-color: #6495ED; /* igual al color de fondo */
border-bottom: 0;
bottom: -20px; /* igual al borde + el padding-bottom de la definición anterior */
content: "";
display: block;
height: 0;
margin: auto;
overflow: hidden;
position: relative;
width: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
</script>
<map name="mapa" class="figuras">
<area id="p_area1" class="area1" shape="circle" coords="125,125,50" href=""
onmouseover="writeText('Esto es un circulo')" onmouseout="ondelete()">
<area id="p_area2" class="area2" shape="rectangle" coords="325,75,425,175" href=""
onmouseover="writeText('Esto es un rectangulo')" onmouseout="ondelete()">
</map>
<div id="bloque2" class="externo">
<img src="http://i.stack.imgur.com/GvHyu.png" usemap="#mapa" >
<div id="bloque1" class="interno" >
</div>
</div>