Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement snap-scrolling in the webpage #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions CSS/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,30 @@
}
body {
background: #000;
width: 100vw;
height: 100vh;
margin: 0;
color: #fff;
font-family: "VT323", monospace;
overflow-x: hidden;
}

.container {
width: 100%;
height: 100%;
scroll-snap-type: y mandatory;
overflow-y: sroll;
overflow-x: hidden;
}
.section-a,
.section-b,
.section-c,
.section-d {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
scroll-snap-align: center;
}

a {
Expand Down Expand Up @@ -90,11 +112,16 @@ ul {
section {
position: relative;
height: 100vh;
width: 100vw;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
text-transform: uppercase;
/* object-fit: cover; */
display: flex;
justify-content: center;
align-items: center;
scroll-snap-align: start;
}

.section-inner {
Expand Down Expand Up @@ -144,8 +171,6 @@ section {
font-size: 20px;
}



.btn {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -274,7 +299,6 @@ section {
/* footer */
footer {
position: relative;
padding: 55px 0;
}

footer ul {
Expand Down
34 changes: 16 additions & 18 deletions JS/script.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
const btn = document.getElementById('menu-btn');
const overlay = document.getElementById('overlay');
const menu = document.getElementById('mobile-menu');
const counters = document.querySelectorAll('.counter');
const menuBtn = document.getElementById('menu');
const menuContent = document.querySelector('.menu-content');

const btn = document.getElementById("menu-btn");
const overlay = document.getElementById("overlay");
const menu = document.getElementById("mobile-menu");
const counters = document.querySelectorAll(".counter");
const menuBtn = document.getElementById("menu");
const menuContent = document.querySelector(".menu-content");

let scrollStarted = false;

// btn.addEventListener('click', navToggle);
document.addEventListener('scroll', scrollPage);
document.addEventListener("scroll", scrollPage);

function navToggle() {
btn.classList.toggle('open');
overlay.classList.toggle('overlay-show');
document.body.classList.toggle('stop-scrolling');
menu.classList.toggle('show-menu');
btn.classList.toggle("open");
overlay.classList.toggle("overlay-show");
document.body.classList.toggle("stop-scrolling");
menu.classList.toggle("show-menu");
}

function scrollPage() {
Expand All @@ -32,11 +31,11 @@ function scrollPage() {

function countUp() {
counters.forEach((counter) => {
counter.innerText = '0';
counter.innerText = "0";

const updateCounter = () => {
// Get count target
const target = +counter.getAttribute('data-target');
const target = +counter.getAttribute("data-target");
// Get current counter value
const c = +counter.innerText;

Expand All @@ -59,14 +58,13 @@ function countUp() {
}

function reset() {
counters.forEach((counter) => (counter.innerHTML = '0'));
counters.forEach((counter) => (counter.innerHTML = "0"));
}

// menu button
function myFunction(x) {
x.classList.toggle("change");
}
menuBtn.addEventListener('click', () => {
menuContent.classList.toggle('active');
menuBtn.addEventListener("click", () => {
menuContent.classList.toggle("active");
});

189 changes: 87 additions & 102 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,77 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/script.js" defer></script>
<title>Indian Space Research Organisation</title>
</head>

<body>
<header class="main-header">
<div class="logo">
<a href="index.html">
<img src="images/logo.png" alt="ISRO" />
</a>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/script.js" defer></script>
<title>Indian Space Research Organisation</title>
</head>

<body>
<header class="main-header">
<div class="logo">
<a href="index.html">
<img src="images/logo.png" alt="ISRO" />
</a>
</div>
<nav class="desktop-main-menu">
<ul>
<li><a href="PSLV.html">Polar Satellite LV</a></li>
<li><a href="GSLV.html">Geo Satellite LV</a></li>
<li><a href="LVM3.html">Geo Satellite M3</a></li>
<li><a href="COMMU.html">Communication Satellites</a></li>
<li><a href="Foreign.html">Foreign Satellites</a></li>
</ul>
<div class="menu-content">
<div id="menu-navigation">
<ul class="nav-link">
<li class="nav-item primary"><a href="">Mission</a></li>
<li class="nav-item primary"><a href="">Launches</a></li>
<li class="nav-item primary"><a href="Careers.html">Careers</a></li>
<li class="nav-item primary"><a href="">Updates</a></li>
</ul>
</div>
</div>
<nav class="desktop-main-menu">
<ul>
<li><a href="PSLV.html">Polar Satellite LV</a></li>
<li><a href="GSLV.html">Geo Satellite LV</a></li>
<li><a href="LVM3.html">Geo Satellite M3</a></li>
<li><a href="COMMU.html">Communication Satellites</a></li>
<li><a href="Foreign.html">Foreign Satellites</a></li>
</ul>
<div class="menu-content">
<div id="menu-navigation">
<ul class="nav-link">
<li class="nav-item primary"><a href="">Mission</a></li>
<li class="nav-item primary"><a href="">Launches</a></li>
<li class="nav-item primary"><a href="Careers.html">Careers</a></li>
<li class="nav-item primary"><a href="">Updates</a></li>
</ul>
</div>
<button id="menu">
<div id="bar" onclick="myFunction(this)">
<div id="bar1" class="bar"></div>
<div id="bar2" class="bar"></div>
<div id="bar3" class="bar"></div>
</div>
<button id="menu">
<div id="bar" onclick="myFunction(this)">
<div id="bar1" class="bar"></div>
<div id="bar2" class="bar"></div>
<div id="bar3" class="bar"></div>
</div>
</button>
</nav>
</header>
</button>
</nav>
</header>

<div class="container">
<!-- Section-A -->

<section class="section-a">
<div class="section-inner">
<h4>Upcoming Launch</h4>
<h2>Chandrayaan-3</h2>
<a href="https://www.youtube.com/live/q2ueCg9bvvQ?si=H4V6-fhBdRc2GfqS" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>
</a>
<div class="scroll-arrow"> <svg width="30px" height="20px">
<path
stroke="#ffffff"
fill="none"
stroke-width="2px"
d="M2.000,5.000 L15.000,18.000 L28.000,5.000 "
></path>
</svg></div>


<div class="section-inner">
<h4>Upcoming Launch</h4>
<h2>Chandrayaan-3</h2>
<a href="https://www.youtube.com/live/q2ueCg9bvvQ?si=H4V6-fhBdRc2GfqS" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>
</a>
<div class="scroll-arrow"> <svg width="30px" height="20px">
<path stroke="#ffffff" fill="none" stroke-width="2px" d="M2.000,5.000 L15.000,18.000 L28.000,5.000 ">
</path>
</svg></div>


<div class="scroll-arrow">
<svg width="30px" height="20px">
<path
stroke="#ffffff"
fill="none"
stroke-width="2px"
d="M2.000,5.000 L15.000,18.000 L28.000,5.000 "
></path>
<path stroke="#ffffff" fill="none" stroke-width="2px" d="M2.000,5.000 L15.000,18.000 L28.000,5.000 ">
</path>
</svg>

</div>
Expand All @@ -85,22 +78,18 @@ <h2>Chandrayaan-3</h2>
<h4>Recent Launch</h4>
<h2>PSLV-C54/EOS-06</h2>

<a href="https://www.youtube.com/live/hHfDIMb37wM?si=jhcOeEgmvAXEx8_a" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>
<a href="https://www.youtube.com/live/hHfDIMb37wM?si=jhcOeEgmvAXEx8_a" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>




</a>
<div class="scroll-arrow">
<svg width="30px" height="20px">
<path
stroke="#ffffff"
fill="none"
stroke-width="2px"
d="M2.000,5.000 L15.000,18.000 L28.000,5.000 "
></path>
<path stroke="#ffffff" fill="none" stroke-width="2px" d="M2.000,5.000 L15.000,18.000 L28.000,5.000 ">
</path>
</svg>
</div>
</div>
Expand All @@ -113,20 +102,16 @@ <h2>PSLV-C54/EOS-06</h2>
<h4>Recent Mission</h4>
<h2>GSLV-F12/NVS-01</h2>

<a href="https://www.youtube.com/live/nGRsTQyrVL4?si=dyFgDG1gSZkzNUrs" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>
<a href="https://www.youtube.com/live/nGRsTQyrVL4?si=dyFgDG1gSZkzNUrs" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>

</a>
<div class="scroll-arrow">
<svg width="30px" height="20px">
<path
stroke="#ffffff"
fill="none"
stroke-width="2px"
d="M2.000,5.000 L15.000,18.000 L28.000,5.000 "
></path>
<path stroke="#ffffff" fill="none" stroke-width="2px" d="M2.000,5.000 L15.000,18.000 L28.000,5.000 ">
</path>
</svg>
</div>
</div>
Expand All @@ -138,25 +123,25 @@ <h2>GSLV-F12/NVS-01</h2>
<div class="section-inner">
<h2>GSAT-31 Update</h2>

<a href="https://youtu.be/mOTy0OB1vbM?si=bxGrEvly6X1CLNBu" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>
<a href="https://youtu.be/mOTy0OB1vbM?si=bxGrEvly6X1CLNBu" target="_blank" class="btn animate">
<div class="hover">
<span>Rewatch</span>
</div>

</a>
<div class="scroll-arrow">
<svg width="30px" height="20px">
<path
stroke="#ffffff"
fill="none"
stroke-width="2px"
d="M2.000,5.000 L15.000,18.000 L28.000,5.000 "
></path>
<path stroke="#ffffff" fill="none" stroke-width="2px" d="M2.000,5.000 L15.000,18.000 L28.000,5.000 ">
</path>

</svg></div>
</div>
</section>
<footer>
</svg>
</div>
</div>
</section>
</div>

<!-- footer section -->
<footer>
<ul>
<li>ISRO &copy; 2023</li>
<li><a href="https://twitter.com/isro" target="_blank">Twitter</a></li>
Expand All @@ -167,6 +152,6 @@ <h2>GSAT-31 Update</h2>
</ul>
</footer>


</body>
</html>

</html>