0

Есть код:

jQuery(function($) {
  $('div').hover(function(e) {
    e.stopPropagation();
    e.preventDefault();
    $(this).css('outline', '5px solid red');
  }, function() {
    $(this).css('outline', 'none');
  });
});
.big {
  width: 300px;
  height: 300px;
  background: #ff0;
}
.avg {
  width: 200px;
  height: 200px;
  background: #aa0;
}
.small {
  width: 100px;
  height: 100px;
  background: #770;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class='big'>
  <div class='avg'>
    <div class='small'>
    </div>
  </div>
</div>

Как сделать так, чтобы при наведении на выбранный элемент, выделялся только он? Причем как при переходе с более светлого элемента к темному, так и наоборот.

2

1 ответ 1

0

Вместо hover нужно использовать mouseover/mouseout

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.