Spotlight Effect On Mousemove Using jQuery And CSS3

File Size: 1.2 KB
Views Total: 2292
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Spotlight Effect On Mousemove Using jQuery And CSS3

This is a simple example shows how to highlight part of the webpage using a Spotlight effect. Powered by jQuery and CSS Radial-gradient function.

See also:

How to use it:

1. Create an element for the Sportlight effect.

<div class="focus"></div>

2. Load the latest version of jQuery library at the end of the document.

<script src="" 

3. The JavaScript (jQuery script) to enable the spotlight effect on mousemove.

$(document).mousemove(function(e) {
  var X = e.pageX;
  var Y = e.pageY;
    "radial-gradient(circle at " +
      X +
      "px " +
      Y +
      "px, transparent, #000 30%)"

This awesome jQuery plugin is developed by veeteefunk. For more Advanced Usages, please check the demo page or visit the official website.