JSFiddle - React, Tailwind, and code Playground
HTML
<div class="aaa" style="position: relative; left: 50px; top: 30px; width: 300px; height: 50px; background: #222222;"></div>
<div class="aaa" style="position: relative; left: 50px; top: 30px; width: 300px; height: 50px; background: #222222;"></div>
<div id="tog" style="position: relative; left: 50px; top: 30px; width: 300px; height: 50px; background: #555555;"> toggle</div>
JavaScript
var flag = true;
$('.aaa').mouseenter(function () {
if(!flag) return;
$(this).css('background', '#aaaaaa');
$(this).css('border', 'solid 1px red');
});
$('.aaa').mouseleave(function () {
if(!flag) return;
$(this).css('background','blue');
$(this).css('border', 'solid transparent 1px');
});
$('#tog').click(function () {
flag = !flag;
});