9
I would like to know how to disable the central button of mouse who has the scroll?
I don’t want to take the scroll just the button of scroll of mouse that features arrow to left up and down when you click on it, I want to disable it.
9
I would like to know how to disable the central button of mouse who has the scroll?
I don’t want to take the scroll just the button of scroll of mouse that features arrow to left up and down when you click on it, I want to disable it.
8
You can try something like this:
$('body').mousedown(function(e) {
if (e.button == 1) return false;
});
Note that older browsers may not work the same way. Try this code on Jsfiddle.
4
You can prevent the click with the scroll button, example:
$('body').mousedown(function(e){
/*button == 0 botão esquerdo do mouse
*button == 1 botão do meio, ou botão de scroll
*button == 2 botão direito do mouse
*/
if(e.button==1){
alert('Botão desabilitado');
return false
}
});
div{
width:100%;
height:300px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Clique com o botão do scroll</div>
With pure javascript, make:
document.body.onmousedown = function(e){
if(e.button == 1) {
alert('Botão desabilitado');
return false;
}
}
div{
width:100%;
height:600px;
}
<div>Clique com o botão de scroll</div>
Browser other questions tagged javascript jquery css
You are not signed in. Login or sign up in order to post.
Thanks for the help I help a lot, gave straight here, thanks guys.
– user10323