2
Hello I have the following code.
function abreConteudo(element) {
alert($(element).attr('class'));
alert($(element > "div.descricaoobs").text());
}
$(document).ready(function () {
$("div.botao_melhor_leitura").click(function (e) {
$(this).find(".descricaoobs").attr('style', 'display:block;');
var mousex;
var estado = $(this).find(".descricaoobs").attr('class');
/*var tipVisX = $(window).width();*/
$(this).find(".descricaoobs").css({
right: mousex
});
})
})
.descricaoobs{
overflow-y:hidden;
border: #999999 solid 1px;
background-color:#F8F8FF;
position:center;
padding:1px 3px;
position: absolute;
display: none;
text-align: left;
font-size:12px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Globo.com Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
</head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<body>
<table style="width:100%" border="1">
<tr>
<td>id</td>
<td>obs</td>
<td>Teste1</td>
<td>Teste2</td>
<td>Teste3</td>
<td>Teste4</td>
<td>Teste5</td>
</tr>
<tr>
<td>Eve</td>
<td>
<div class='botao_melhor_leitura'>
<button type="button">Clique aqui</button>
<div class='descricaoobs'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat qua</div>
</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat quam. Aenean suscipit lectus massa, sit</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat quam. Aenean suscipit lectus massa, sit</td>
</tr>
</table>
</body>
</html>
which is intended to open a div with a text when I click the button.So far so good, the problem is that I need a boot to get out of this div. It can be a close button or when clicking outside the div close the same.
Can someone help me.
can also use $('. descricaoobs'). css('visibility','Hidden');
– Gabriel Rodrigues