A JavaScript library for tracking mouse movement and input focus.
npm install eye-on-itbash
$ npm install eye-on-it
`
When you use React
`js
// import eye-on-it JS
import { initEyeOnIt } from "eye-on-it";
// import eye-on-it styles
import "eye-on-it/style.css";
const App = () => {
useEffect(() => {
initEyeOnIt();
}, []);
};
`
$3
`html
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/eye-on-it/dist/style.css"
/>
`
If you use ES module in the browser, there is a CDN version for that too,
`html
`
$3
If you want to use eye-on-it assets locally, you can directly download them from https://www.jsdelivr.com/package/npm/eye-on-it
Add eye-on-it HTML Layout
Now, we need to add a basic eye-on-it layout to our app,
`html
eye
`
Example
But if I do this, I think it'll look weird and I don't understand.
So I prepared an example code.
`html
Eye On It Example
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/eye-on-it/dist/style.css"
/>
`
`css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100%;
height: 100vh;
background-color: #fafafa;
display: flex;
justify-content: center;
align-items: center;
> div {
margin-right: 40px;
}
}
.face {
margin: 0 auto;
width: fit-content;
display: flex;
> div {
width: 20px;
height: 30px;
border: 1px solid black;
& + div {
margin-left: 10px;
}
}
}
.eye {
width: 8px;
height: 12px;
background-color: black;
}
.input-wrapper {
display: flex;
flex-direction: column;
gap: 10px;
}
.input,
.textarea {
width: 20vw;
min-width: 300px;
height: 24px;
margin-top: 20px;
}
.textarea {
height: 50px;
}
.textarea.long {
height: 300px;
}
``