JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<div class="item">
<a href="#">
<div class="flashlight"></div>
<h2>Интернет-<br>магазин</h2>
<p>Полноценный онлайн-магазин для вашего бизнеса</p>
</a>
</div>
CSS
body {
background: #f5f5f5;
}
.item {
position: relative;
}
a {
display: block;
width: 100%;
height: 100%;
padding: 25px;
color: #000;
position: relative;
overflow: hidden;
text-decoration: none;
}
.flashlight {
background: #343434;
position: absolute;
z-index: 1;
height: 270px;
width: 270px;
border-radius: 50%;
left: -270px;
top: -270px;
cursor: pointer;
}
h2 {
font-size: 48px;
font-weight: 900;
margin-bottom: 20px;
position: relative;
color: #343434;
z-index: 2;
mix-blend-mode: difference;
}
p {
margin: 0;
color: #343434;
position: relative;
font-size: 18px;
font-weight: 400;
z-index: 2;
mix-blend-mode: difference;
}
JavaScript
var $serviceItem = $('.item');
$serviceItem.mousemove(function (e) {
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
var $flashlight = $(this).find('.flashlight');
$flashlight.css({
'left': x - 135,
'top': y - 135,
'opacity': 1,
'transition': 'none'
});
});
$serviceItem.mouseout(function (e) {
var $flashlight = $(this).find('.flashlight');
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
$flashlight.css({
'left': x,
'top': y,
'opacity': 0,
'transition': 'all .5s ease'
});
});