custom cursor
a fiddle to d
by Bhavik Bamania
HTML
<div class='cursor'></div>
<div class='cursor'></div>
<h1>Custom cursor</h1>
SCSS
@import url("https://use.typekit.net/pon8ywh.css");
* {
cursor: none;
}
body {
background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(https://images.unsplash.com/photo-1496885950879-f0bb5768d2a6?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b898d20fb2b464bfbdf31f598d8caa37&auto=format&fit=crop&w=2550&q=80) center center;
background-size: cover;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
h1 {
color: white;
font-family: futura-pt, sans-serif;
letter-spacing: 10px;
font-weight: bold;
text-transform: uppercase;
}
.cursor {
position: absolute;
height: 10px;
width: 10px;
border-radius: 50%;
transform: translateX(-50%) translateY(-50%);
}
.cursor:nth-child(1) {
background-color: #00f8f8;
z-index: 1;
}
.cursor:nth-child(2) {
background-color: #fff;
}
JavaScript
$(document)
.mousemove(function(e) {
$('.cursor')
.eq(0)
.css({
left: e.pageX,
top: e.pageY
});
setTimeout(function() {
$('.cursor')
.eq(1)
.css({
left: e.pageX,
top: e.pageY
});
}, 100);
})