<div id="element">
Нажми на меня
</div>
body {
background-color: #eee;
}
#element {
display: block;
height: 50px;
line-height: 50px;
width: 250px;
text-align: center;
background-color: #404040;
font-size: 12pt;
font-family: Verdana, Tahoma, sans-serif;
cursor: pointer;
color: #fff;
}
#element:hover {
background-color: #545454;
}
$('#element').mousedown(function(event) {
switch (event.which) {
case 1:
alert('Левая кнопка мыши были нажата.');
break;
case 2:
alert('Средняя кнопка мыши была нажата.');
break;
case 3:
alert('Правая кнопка мыши была нажата.');
break;
default:
alert('У вас очень странная мышь :)');
}
});
This Pen doesn't use any external CSS resources.