0
People, when right-clicking on the word menu a small menu opens. How do I make this happen inside the table’s (row) property?
document.oncontextmenu = function() {return false;}; //não deixa abrir o menu ao clicar
$('.menu_pai').mousedown(function(e){
if( e.button == 2 ) { //verifica se é o botão direito
$(this).find('.menu').show();//mostra a div filha
}
});
$(document).mousedown(function(e) {
if (e.button != 2) {
$('.menu').hide();
}
});
.menu{
display: none;
}
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<table width="100%" border="1" >
<tr>
<td>ID:1</td>
<td>Nome</td>
<td>Idade</td>
</tr>
</table>
<div class="menu_pai">
Menu
<div class="menu">
link1 <br> link2
</div>
</div>
You want this menu to open inside the line?
– Igor Mello
Your question is not clear enough, I suggest you edit the question.
– Ivan Ferrer
Igor Mello I want it to be like this. when right-clicking div appears outside the line. The tricky and make her appear, the positioning I’ll arrange with css.
– Hugo Borges
@Hugoborges When right-clicking on the row/column?
– Igor Mello
by clicking the entire line
– Hugo Borges