CSS2 Spotlight
How do I make an css2 spotlight?
What is a css2 spotlight? How do you make a css2 spotlight? This script and codes were developed by Nick Mkrtchyan on 10 November 2022, Thursday.
CSS2 Spotlight - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS2 Spotlight</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body>
<div id="label"> <h1>CSS2 Spotlight</h1> <p> Turn on the <strong>light!</strong> </p> <p> Works with Webkit, Firefox, Opera & Explorer </p> <br><br> See <a id="click" href="https://codepen.io/Sonick/pen/lHtDf/"> </a><a id="show" href="#">3D Gallery</a>
</div>
<div id="xspot_t" style="height: 163px;"></div>
<div id="xspot_b" style="top: 463px;"></div>
<div id="xspot_l" style="top: 163px; width: 345px;"></div>
<div id="xspot_r" style="left: 645px; top: 163px;"></div>
<div id="xspot" style="left: 345px; top: 163px;"></div>
</body> <script src="js/index.js"></script>
</body>
</html>
CSS2 Spotlight - Script Codes CSS Codes
* { margin: 0; padding: 0;
}
html, body { overflow: hidden; background: #323E65;
}
#label { margin-top: 6em; font-family: Georgia; color: #FFF; text-align: center;
}
h1 { font-size: 24pt; letter-spacing: 4pt;
}
p { font-size: 48pt; line-height: 48pt;
}
p + p { font-size: 18pt; color: gold;
}
strong { display: block; font-size: 100pt; line-height: 100pt;
}
a { text-decoration:none; }
a#click { color:transparent; z-index:3; position:relative; margin-right:-12em; width:12em; display:inline-block }
a#show{ color:#0099FF; z-index:0; position:relative; }
#xspot { position:absolute; width:300px; height:300px; cursor:none; background:
url(http://alteredqualia.com/visualization/img/spotlight.png); z-index:2 }
#xspot_t { position:absolute; top:0; left:0; width:100%; height:300px; background:url(http://alteredqualia.com/visualization/img/black80.png); }
#xspot_b { position:absolute; top:0; left:0; width:100%; height:100%; background:url(http://alteredqualia.com/visualization/img/black80.png); }
#xspot_l { position:absolute; top:0; left:0; width:100%; height:300px; background:url(http://alteredqualia.com/visualization/img/black80.png); }
#xspot_r { position:absolute; top:0; left:0; width:100%; height:300px; background:url(http://alteredqualia.com/visualization/img/black80.png); }
CSS2 Spotlight - Script Codes JS Codes
var xspot = document.getElementById('xspot');
var xspot_t = document.getElementById('xspot_t');
var xspot_b = document.getElementById('xspot_b');
var xspot_l = document.getElementById('xspot_l');
var xspot_r = document.getElementById('xspot_r');
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
function clamp(x) { return x>=0 ? x : 0;
}
/* A bit of JS to respond to mouse events */
function moveSpot(e){ var gx = 0; var gy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { gx = e.pageX; gy = e.pageY; } else if (e.clientX || e.clientY) { gx = e.clientX + document.body.scrollLeft; gy = e.clientY + document.body.scrollTop; } xspot.style.left = (gx-150)+"px"; xspot.style.top = (gy-150)+"px"; xspot_t.style.height = clamp(gy-150)+"px"; xspot_b.style.top = (gy+150)+"px"; xspot_r.style.left = (gx+150)+"px"; xspot_r.style.top = (gy-150)+"px"; xspot_l.style.top = (gy-150)+"px"; xspot_l.style.width = clamp(gx-150)+"px";
}
window.onload = function() { document.onmousemove = moveSpot;
}
Developer | Nick Mkrtchyan |
Username | Sonick |
Uploaded | November 10, 2022 |
Rating | 4.5 |
Size | 2,531 Kb |
Views | 14,168 |
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 |
Preloader | 2,981 Kb |
Slider | 2,764 Kb |
Mozilla DevDerby | 21,599 Kb |
Canvas Background Effect 3 | 3,029 Kb |
3D Gallery | 4,628 Kb |
JQuery Gallery Simple 3D Effect | 3,584 Kb |
CSS3 Room | 2,718 Kb |
Canvas Hover Effect | 2,833 Kb |
CSS3 Text Animation Effect | 4,470 Kb |
Canvas Starfield | 2,827 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 |
Drop Cap | Gsaiki | 1,571 Kb |
Draggable directive | YahyaKacem | 2,277 Kb |
Toggling Divs with jQuery | Yying6 | 1,967 Kb |
Long Shadow Button | Uixcrazy | 3,550 Kb |
Bootstrap example | Ssaakkaa | 2,716 Kb |
Pure CSS Dial | Lukewatts | 3,018 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
CSS Heart Loaders | Nourabusoud | 2,161 Kb |
NgEasyModal | Lorenzodianni | 4,159 Kb |
Sass random color animation | Jotavejv | 4,827 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!