div with a blue gradient style and set it to fixed position with full viewport coverage and a lower Z-index.Before </body> tag to track mouse movement and update the gradient position.To make a blue gradient background follow the cursor on your Webflow site, including when hovering over other elements, follow these steps:
div: Go to your Webflow Designer and insert a new div element that will serve as the gradient background.div with your desired blue gradient. Adjust the gradient direction and colors as needed.
fixed: Ensure the div is positioned fixed, covering the whole viewport. You can do this by setting the position to Fixed and adjusting the width and height to 100vw and 100vh, respectively.
Before </body> tag: Go to your Webflow Project Settings, find the custom code section, and insert your JavaScript snippet to track the cursor.```javascript
document.addEventListener('mousemove', function(e) {
let x = e.clientX / window.innerWidth * 100;
let y = e.clientY / window.innerHeight * 100;
document.querySelector('.your-gradient-class').style.backgroundPosition = ${x}% ${y}%;
});
```
.your-gradient-class with the actual class name you used for your div.
To create a background gradient that follows the cursor, you need to create a div with a gradient, position it fixed behind all other elements, and implement custom JavaScript to track mouse movements. This ensures the gradient shifts correspondingly across the viewport.