File tree Expand file tree Collapse file tree 3 files changed +92
-0
lines changed Expand file tree Collapse file tree 3 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 1+ const cursor = document . querySelector ( ".cursor" ) ;
2+
3+ document . addEventListener ( "mousemove" , function ( event ) {
4+ // event.pageX --> across
5+ // event.pageY --> up and down
6+ // console.log(event);
7+ moveCursor ( event . pageX , event . pageY ) ;
8+ } ) ;
9+
10+ const moveCursor = function ( pageX , pageY ) {
11+ cursor . style . left = pageX + "px" ;
12+ cursor . style . top = pageY + "px" ;
13+ } ;
Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 " />
4+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Cursor</ title >
7+ < link rel ="stylesheet " href ="style.css " />
8+ </ head >
9+ < body >
10+ < div class ="cursor "> </ div >
11+ < div class ="container ">
12+ < h1 > Mouse Cursor Project</ h1 >
13+ < p >
14+ Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dignissimos
15+ facere debitis veniam blanditiis earum doloribus sapiente doloremque,
16+ perferendis architecto tempora, quod eaque laboriosam ad necessitatibus
17+ amet ex. Labore, sed autem.
18+ </ p >
19+ < button > Learn More</ button >
20+ </ div >
21+
22+ < script src ="app.js "> </ script >
23+ </ body >
24+ </ html >
Original file line number Diff line number Diff line change 1+ @import url ("https://fonts.googleapis.com/css2?family=Playfair+Display+SC:wght@700&display=swap" );
2+
3+ body {
4+ height : 100vh ;
5+ background : # 000 ;
6+ display : flex;
7+ flex-direction : column;
8+ justify-content : center;
9+ align-items : center;
10+ }
11+
12+ .container {
13+ text-align : center;
14+ margin : 0 auto;
15+ }
16+
17+ h1 {
18+ color : # fff ;
19+ font-size : 4rem ;
20+ font-family : "Playfair Display SC" , serif;
21+ }
22+
23+ p {
24+ color : # fff ;
25+ max-width : 700px ;
26+ font-family : sans-serif;
27+ letter-spacing : 2px ;
28+ line-height : 22px ;
29+ margin-bottom : 40px ;
30+ }
31+
32+ button {
33+ padding : 0 ;
34+ margin : 0 ;
35+ border : transparent;
36+ background : transparent;
37+ color : # fff ;
38+ border : 2px solid white;
39+ padding : 10px 20px ;
40+ font-weight : bold;
41+ text-transform : uppercase;
42+ cursor : pointer;
43+ }
44+
45+ /* JavaScript */
46+ div .cursor {
47+ position : absolute;
48+ top : 50% ;
49+ left : 50% ;
50+ width : 15px ;
51+ height : 15px ;
52+ background : yellow;
53+ border-radius : 50% ;
54+ transform : translate (-50% , -50% );
55+ }
You can’t perform that action at this time.
0 commit comments