<div></div>
<span>Щелкните правой<br/>кнопкой мыши по блоку</span>
div {
  background: blue;
  color: white;
  height: 100px;
  width: 150px;
}

div.contextmenu {
  background: yellow;
  color: black;
}
$(function() {
  var div = $( "div:first" );
  div.contextmenu(function() {
    div.toggleClass( "contextmenu" );
  });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js