Skip to content

Commit

Permalink
Merge pull request #41 from Speedysays01/MouseFollower
Browse files Browse the repository at this point in the history
Added a mouse follower
  • Loading branch information
akhileshverma92 authored Oct 4, 2024
2 parents da11bdf + 7a2b459 commit beab801
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
</ul>
</div>
</nav>


<div class="mouse-follower" id="mouseFollower"> </div>
<div class="hero">
<video autoplay muted loop id="background-video">
<source src="assets/videos/bg.mp4" type="video/mp4">
Expand Down Expand Up @@ -117,6 +118,9 @@ <h2>Register Now</h2>
</form>
</div>
</section>




<footer>
<p>&copy; 2024 College Club. All rights reserved.</p>
Expand Down
12 changes: 11 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,14 @@ document.getElementById('registration-form').addEventListener('submit', function
const target = this.getAttribute('href'); // Get the target section ID
smoothScroll(target); // Call the smooth scroll function
});
});
});


document.addEventListener("mousemove", function (e) {
const follower = document.getElementById("mouseFollower");

// Move the follower div to the mouse position
follower.style.left = `${e.clientX}px`;
follower.style.top = `${e.clientY}px`;
});

16 changes: 16 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,22 @@ footer {
}


/* Mouse follower*/
/* Make the mouse follower element */
.mouse-follower {
position: fixed;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: rgba(190, 190, 190, 0.5);
transform: translate(-50%, -50%);
pointer-events: none;
z-index: 9999;
transition: transform 0.1s ease;
}



/* Animations */
@keyframes fadeIn {
from {
Expand Down

0 comments on commit beab801

Please sign in to comment.