Samajh gaya bhai — tu “scroll pe next section / page jaisa feel” wali website banana chahta hai (like Apple, landing pages, etc.).
Isko bolte hain π Single Page Scroll Website (sections instead of pages)
π§ Concept simple hai:
Ek hi page hota hai
Usme multiple sections (divs) hote hain
Har section = ek “page jaisa feel”
Scroll karte hi next section full screen pe aata hai
π₯ Basic React Example (Full Working)
π Structure
src/
├── App.jsx
├── App.css
✅ App.jsx
import './App.css';
function App() {
return (
<div className="container">
<section className="section section1">
<h1>Welcome to the World of Automation</h1>
<p>Easytrain</p>
</section>
<section className="section section2">
<h1>Our Services</h1>
<p>We build smart automation solutions</p>
</section>
<section className="section section3">
<h1>About Us</h1>
<p>We are a tech-driven company</p>
</section>
<section className="section section4">
<h1>Contact</h1>
<p>Get in touch with us</p>
</section>
</div>
);
}
export default App;
π¨ App.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
scroll-snap-type: y mandatory;
overflow-y: scroll;
height: 100vh;
}
.section {
height: 100vh;
scroll-snap-align: start;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
text-align: center;
}
/* Different colors for sections */
.section1 {
background: #111;
color: white;
}
.section2 {
background: #007bff;
color: white;
}
.section3 {
background: #28a745;
color: white;
}
.section4 {
background: #ffc107;
color: black;
}
✨ Result kya hoga:
Har scroll pe ek naya “page-like section”
Smooth snapping effect π₯
Modern landing page feel
π Advanced (next level banana hai?)
Agar tu aur pro banana chahta hai toh use kar:
framer-motion→ animationsreact-scroll→ smooth navigationlocomotive-scroll→ premium scrolling feel
π§ Real world example:
Apple website π
Tesla website π
Startup landing pages
Agar tu bole toh main tujhe:
π animation + navbar + smooth scroll + modern UI wala full project bana ke de sakta hoon (resume level π₯)
No comments:
Post a Comment