<div class="radial-gradient"></div>
index.html
.radial-gradient {
position:fixed;
top:0px;
left:0px;
height:100%;
width:100%;
/*Fallback if gradeints don't work */
background: #ff0000;
/*Linear gradient... */
background:
radial-gradient(
at center, #ff0000, #0000ff
);
}
index.css
$(document).mousemove(function(event) {
windowWidth = $(window).width(); // vw
windowHeight = $(window).height(); // vh
mouseXpercentage = Math.round(event.pageX / windowWidth * 100);
mouseYpercentage = Math.round(event.pageY / windowHeight * 100);
$('.radial-gradient').css('background', 'radial-gradient(at ' + mouseXpercentage + '% ' + mouseYpercentage + '%, #ff0000, #0000ff)');
});
index.js