1
I am using Jquery Dropdown: https://labs.abeautifulsite.net/jquery-dropdown/
In the project’s Issue, there is a code that prevents the menu from closing by clicking as a left button, I would like it just not to close with the right click. In the example below, when you click inside a link in the dropdown, it remains open, but not with the right click, let’s say, to open the link in a new tab...
the code is the one that’s outside the library.
$("#jq-dropdown-1").on("click",function(event){
event.stopPropagation();
$('#jq-dropdown-1').dropdown('show');
});
<link href="https://labs.abeautifulsite.net/jquery-dropdown/jquery.dropdown.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="https://labs.abeautifulsite.net/jquery-dropdown/jquery.dropdown.min.js"></script>
<a href="#" data-jq-dropdown="#jq-dropdown-1">Dropdown</a>
<div id="jq-dropdown-1" class="jq-dropdown jq-dropdown-tip">
<ul class="jq-dropdown-menu">
<li><a href="#">Science</a></li>
<li><a href="#">Eletronics</a></li>
<li><a href="#">Pellentesque convallis enim.</a></li>
<li><a href="#">Internet</a></li>
<li><a href="#">Business</a></li>
</ul>
</div>
In which browser do you have this problem?
– Leandro Angelo
@Leandroangelo in firefox quantum 58.0.2
– John Quimera
@Leandroangelo in Chrome works perfectly, both right and left. In that case I wanted to stop the spread just by right clicking on a link to open in a new tab. I tried with contextmenu, but it doesn’t work in firefox.
– John Quimera
Firefox doesn’t like you to change your default settings and when you right-click the focus leaves your dropdown and goes to its menu. In these latest versions of the browser I only saw work, with this behavior, the dropdown of bootstrap.
– Leandro Angelo
Come on John, it was a bit confusing your question, but from what I understand, you want to right-click on a link, redirect to the page?
– Jorge.M
@Jorge the problem was solved below by dvd
– John Quimera