Change background color based on mouse location
How do I make an change background color based on mouse location?
Change background color based on mouse location using javascript.. What is a change background color based on mouse location? How do you make a change background color based on mouse location? This script and codes were developed by Michael Chernin on 19 January 2023, Thursday.
Change background color based on mouse location - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Change background color based on mouse location</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Change background color based on mouse location - Script Codes JS Codes
'use strict';
// create div element
var div = document.createElement('DIV');
// set height of element
div.style.height = '100vh';
// append element to DOM
document.body.appendChild(div);
// add event listener to element
div.addEventListener('mousemove', function (event) { console.log(event); var x = event.clientX; var y = event.clientY; div.textContent = x + ', ' + y; div.style.backgroundColor = 'rgb(' + x + ', ' + y + ', 100)';
});
Developer | Michael Chernin |
Username | mchernin34 |
Uploaded | January 19, 2023 |
Rating | 3 |
Size | 2,046 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Image grid with captions | 2,222 Kb |
Column Drop | 1,602 Kb |
Starter Portfolio | 2,235 Kb |
Animated card | 1,729 Kb |
Teachers Apps | 1,895 Kb |
Pure CSS Speech Bubbles | 7,341 Kb |
Popover Navigation | 3,811 Kb |
A Pen by Michael Chernin | 10,496 Kb |
Slide Out Menu | 2,584 Kb |
Icon Grid | 3,040 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
RSW | JordanC | 3,726 Kb |
Starfield using KineticJS | Asp | 3,512 Kb |
Large canvas mousemove experiment | Jibbon | 2,885 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
Light Switch | Bartuc | 4,933 Kb |
Lecture 1 | Law | 0 Kb |
LAMP PURE CSS with Animation | Dam62500 | 2,911 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Mondrian | Chrisarmstrong | 2,787 Kb |
CSS3 Snow Animation | NickyCDK | 1,695 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!