Skip to content

Commit

Permalink
width bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
alurubalakarthikeya committed Aug 4, 2024
1 parent d08139d commit 2993bec
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 129 deletions.
41 changes: 31 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.0/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.0/ScrollTrigger.min.js"></script>

</head>
<body class="night">
<div class="cursor-dot" data-cursor-dot></div>
<div class="cursor-outline" data-cursor-outline></div>
<!--Cursor dot container-->
<div class="cursor-dot" data-cursor-dot></div>
<div class="cursor-outline" data-cursor-outline></div>
<!--Cursor dot container-->
<!--Navigation Bar Code Starts-->
<header>
<div class="logo"><a href="#hero">Mini <span>Minds</span></a></div>
<nav>
Expand All @@ -40,10 +42,14 @@
</ul>
</nav>
</header>
<!--Navigation Bar Code ends-->
<!--Sun and Moon containers-->
<div class="sun-moon-container">
<div id="sun" class="sun" onclick="toggleMode()"></div>
<div id="moon" class="moon" onclick="toggleMode()"></div>
</div>
<!--Sun and Moon containers-->
<!--Home Page Starts-->
<div id="hero" class="hero">
<div class="hero-content fadeInUp-animation">
<h2 class="hehe fadeInUp-animation">Where Learning is <span>made practical</span></h2>
Expand All @@ -64,13 +70,19 @@ <h2 class="hehe fadeInUp-animation">Where Learning is <span>made practical</span
<button class="sign-in">Sign in</button>
<p>no account? <a href="">Sign up</a></p>
</div>
<div class="floating-clouds">
<div class="cloud cloud-1 "><img src="images/cloudy.png" alt="Cloud"></div>
<div class="cloud cloud-2 "><img src="images/cloudy.png" alt="Cloud"></div>
</div>
<!--Cloud resource-->
<div class="floating-clouds">
<div class="cloud cloud-1 "><img src="images/cloudy.png" alt="Cloud"></div>
<div class="cloud cloud-2 "><img src="images/cloudy.png" alt="Cloud"></div>
</div>
<!--Cloud resource end-->
</div>
<!--Home Page Ends-->
<!--Tree resource-->
<img class="tree-1" src="images/tree.png" alt="Tree" width="200px">
<img class="stone" src="images/rock.png" alt="Stone" width="70px">
<!--Tree resource end-->
<!--About section Starts-->
<div id="about" class="about">
<h2 class="heading">Why Us?</h2>
<img class="fade-in-right-target" src="images/about.png" alt="cartoon">
Expand All @@ -79,6 +91,8 @@ <h2 class="heading">Why Us?</h2>
<a class="button-about" href="about.html" target="_blank">Know More</a>
</div>
</div>
<!--About section Ends-->
<!--Courses section Starts-->
<div id="courses" class="courses space">
<h2 class="heading">What do we do?</h2>
<img class="fade-in-right-target" src="images/our courses.png" alt="cartoon">
Expand All @@ -87,6 +101,8 @@ <h2 class="heading">What do we do?</h2>
<a class="button-courses" href="courses.html" target="_blank">Explore courses</a>
</div>
</div>
<!--Courses section Ends-->
<!--Games section Starts-->
<div class="games" id="games">
<h2 class="heading">Our Edu-Games</h2>
<img class="fade-in-right-target" src="images/games.png" alt="cartoon"><br>
Expand All @@ -95,13 +111,17 @@ <h2 class="heading">Our Edu-Games</h2>
<a class="button-games" href="courses.html" target="_blank">Coming soon!!</a>
</div>
</div>
<!--Games section Ends-->
<!--Course list section Starts-->
<div id="course-list" class="course-list">
<h2 class="heading">Our Courses</h2><br>
<div class="box fade-in-left-target"></div>
<div class="box fade-in-right-target"></div>
<div class="box fade-in-left-target"></div>
<div class="box fade-in-right-target"></div>
</div>
<!--Course list section Ends-->
<!--Contact Us section starts-->
<footer>
<div id="contact" class="contact">
<h2 class="heading">Contact Us</h2>
Expand All @@ -125,8 +145,9 @@ <h2 class="heading">Contact Us</h2>
</ul><br></div>
</div>
</footer>
<!--Contact Us section Ends-->
<!--classes for special effect at night -->
<div class="sky"></div>
<div class="stars"></div>
<script src="script.js"></script>
</body>
</html>
<!--classes for special effect at night -->
<script src="script.js"></script>
209 changes: 104 additions & 105 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,121 +1,120 @@
document.addEventListener('DOMContentLoaded', () => {
const menuIcon = document.getElementById('menu-icon');
const menuItems = document.getElementById('menu-items');
const bodyElement = document.getElementById('body');
const menuIcon = document.getElementById('menu-icon');
const menuItems = document.getElementById('menu-items');
const bodyElement = document.getElementById('body');

function toggleMode() {
const body = document.body;
const sun = document.getElementById("sun");
const moon = document.getElementById("moon");

if (body.classList.contains("night")) {
body.classList.remove("night");
body.classList.add("day");
sun.style.display = "block";
moon.style.display = "none";
} else {
body.classList.remove("day");
body.classList.add("night");
sun.style.display = "none";
moon.style.display = "block";
function toggleMode() {
const body = document.body;
const sun = document.getElementById("sun");
const moon = document.getElementById("moon");

if (body.classList.contains("night")) {
body.classList.remove("night");
body.classList.add("day");
sun.style.display = "block";
moon.style.display = "none";
} else {
body.classList.remove("day");
body.classList.add("night");
sun.style.display = "none";
moon.style.display = "block";
}
}

document.getElementById("sun").addEventListener("click", toggleMode);
document.getElementById("moon").addEventListener("click", toggleMode);

menuIcon.addEventListener('click', (event) => {
event.stopPropagation();
menuItems.classList.toggle('active');
});

document.addEventListener('click', (event) => {
if (menuItems.classList.contains('active')) {
menuItems.classList.remove('active');
}
}

document.getElementById("sun").addEventListener("click", toggleMode);
document.getElementById("moon").addEventListener("click", toggleMode);

menuIcon.addEventListener('click', (event) => {
event.stopPropagation();
menuItems.classList.toggle('active');
});

document.addEventListener('click', (event) => {
if (menuItems.classList.contains('active')) {
menuItems.classList.remove('active');
}
});
});

menuItems.addEventListener('click', (event) => {
event.stopPropagation();
});
menuItems.addEventListener('click', (event) => {
event.stopPropagation();
});

const cursorDot = document.querySelector("[data-cursor-dot]");
const cursorOutline = document.querySelector("[data-cursor-outline]");
window.addEventListener("mousemove", (e) => {
const posX = e.clientX;
const posY = e.clientY;
cursorDot.style.left = `${posX}px`;
cursorDot.style.top = `${posY}px`;
cursorOutline.style.left = `${posX}px`; // Adjust position to center outline around dot
cursorOutline.style.top = `${posY}px`;
cursorOutline.animate({
left: `${posX}px`,
top: `${posY}px`
}, { duration: 500, fill: "forwards" });
});
// Hide the default cursor
document.body.style.cursor = 'none';
const cursorDot = document.querySelector("[data-cursor-dot]");
const cursorOutline = document.querySelector("[data-cursor-outline]");

window.addEventListener("mousemove", (e) => {
const posX = e.clientX;
const posY = e.clientY;

cursorDot.style.left = `${posX}px`;
cursorDot.style.top = `${posY}px`;

cursorOutline.style.left = `${posX}px`; // Adjust position to center outline around dot
cursorOutline.style.top = `${posY}px`;

cursorOutline.animate({
left: `${posX}px`,
top: `${posY}px`
}, { duration: 500, fill: "forwards" });
});

// Hide the default cursor
document.body.style.cursor = 'none';

});

document.addEventListener("DOMContentLoaded", function() {
gsap.registerPlugin(ScrollTrigger);
gsap.registerPlugin(ScrollTrigger);

gsap.utils.toArray('.fade-in-up-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, y: 100 }, // Start state
{
opacity: 1,
y: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%', // Animation starts when element is 80% from the top of the viewport
end: 'bottom 20%', // Animation ends when element is 20% from the bottom of the viewport
scrub: true // Smoothly animates while scrolling
}
gsap.utils.toArray('.fade-in-up-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, y: 100 }, // Start state
{
opacity: 1,
y: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%', // Animation starts when element is 80% from the top of the viewport
end: 'bottom 20%', // Animation ends when element is 20% from the bottom of the viewport
scrub: true // Smoothly animates while scrolling
}
);
});
}
);
});

gsap.utils.toArray('.fade-in-left-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, x: -100 }, // Start state
{
opacity: 1,
x: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%',
end: 'bottom 20%',
scrub: true
}
gsap.utils.toArray('.fade-in-left-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, x: -100 }, // Start state
{
opacity: 1,
x: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%',
end: 'bottom 20%',
scrub: true
}
);
});
}
);
});

gsap.utils.toArray('.fade-in-right-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, x: 100 }, // Start state
{
opacity: 1,
x: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%',
end: 'bottom 20%',
scrub: true
}
gsap.utils.toArray('.fade-in-right-target').forEach(el => {
gsap.fromTo(el,
{ opacity: 0, x: 100 }, // Start state
{
opacity: 1,
x: 0, // End state
duration: 2,
scrollTrigger: {
trigger: el,
start: 'top 80%',
end: 'bottom 20%',
scrub: true
}
);
});
}
);
});
});


Loading

0 comments on commit 2993bec

Please sign in to comment.