Mastering Scroll Events (and Overcoming Resistance) Day 10 of the JavaScript Challenge! 🚀 Honestly, I almost didn't post today. I’m currently coding on an HP Stream with a cracked screen that is bleeding "ink" down the display. Between the hardware issues and the end-of-year fatigue, the temptation to quit was high. But I remembered that code doesn't care if your screen is perfect; it only cares if your logic is sound. So, I pushed the editor to the bottom half of the screen and got to work. Today, I built a ScrollSpy Landing Page. The goal was seamless navigation on both desktop and mobile. ✨ Key Features: Sticky Navbar: Used window.pageYOffset to detect when the user scrolls past the header, triggering a CSS class to lock the navbar to the top. Auto-Closing Mobile Menu: A common UX bug in mobile menus is that they stay open after you click a link. I fixed this by looping through all navigation links (querySelectorAll) and forcing the menu to close (classList.remove) whenever a link is clicked. Back-to-Top Button: A dynamic button that only appears after the user has scrolled down 500px. 💻 Code Snippet: JavaScript // Auto-close menu on link click scrollLinks.forEach((link) => { link.addEventListener("click", () => { linksContainer.classList.remove("show-links"); }); }); These small UX details make a huge difference in how a site feels. It wasn't easy to focus today, but showing up when it's hard is part of the job. On to Day 11! 💪 #JavaScript #100DaysOfCode #WebDesign #Frontend #Resilience #BuildingInPublic
More Relevant Posts
-
During recent component refactors, I keep seeing JavaScript used just to add a class when a child element exists. :has() lets CSS express “style this card when it contains an image or a checked input,” which keeps behavior out of templates and avoids DOM reads/writes for styling. The trade-off is being deliberate about selector cost and verifying support in your target browsers, especially in large lists. Where could :has() let you delete state or class-toggling code in your UI? #css #webdev #frontend #performance #designsystems
To view or add a comment, sign in
-
-
A tiny CSS line that designers love. 🎨 Ever have a headline that leaves one lonely word on the second line? (The "widow" problem) You don't need or complex JavaScript anymore. Just add: "text-wrap: balance" The browser automatically calculates the best line break for readability. It’s a one-line upgrade for your UI #CSS #Frontend #WebDesign #Tips
To view or add a comment, sign in
-
Improving user experience is key to a successful website. One often overlooked feature is auto-resizing textareas 📝. In this article, we'll explore how to make textareas grow automatically using JavaScript. By implementing this feature, you can enhance user interaction and reduce frustration. Our tutorial provides a simple and effective solution to auto-resize textareas. Read more: https://lnkd.in/gGrrT2hA #JavaScript #Textarea #AutoResize #UXDesign #WebDevelopment
To view or add a comment, sign in
-
While working on UI styling, I was reminded of a fundamental principle: Many UI effects don’t require JavaScript at all, CSS can handle them efficiently. For example, changing the background of a card section on hover is often implemented with useState, mouse enter/leave handlers, and conditional inline styles—when a simple :hover does the same job. Choosing CSS over unnecessary JS means: Less code Fewer bugs Better performance Strong fundamentals reduce complexity and prevent over-engineering. In tech, simplicity is often the real advantage. #SoftwareEngineering #Frontend #WebDevelopment #CSS #JavaScript #CleanCode #EngineeringPrinciples
To view or add a comment, sign in
-
🚀 Built a Live Search Profile Cards Feature using JavaScript I recently worked on a Live Search UI project using HTML, CSS, and Vanilla JavaScript, focused on performance and clean UI design. 🔹 Key highlights: • Real-time search with debounce optimization • Dynamic card rendering using DOM manipulation • Smooth blurred background image effect • Clean, minimal, and responsive layout 🔹 What I learned: ✔ Efficient DOM handling ✔ Improving performance with debouncing ✔ Structuring reusable UI components ✔ Enhancing user experience with visual effects This project strengthened my fundamentals in frontend development and motivated me to keep building better UIs 🚀 Live page link :- https://lnkd.in/g6Uw-dvM Open to feedback and suggestions 🙌 #JavaScript #FrontendDevelopment #WebDevelopment #HTML #CSS #LearningByBuilding #UIUX #WebDevJourney
To view or add a comment, sign in
-
Stop building "Dumb" UI components. Most libraries give you the skin (CSS), but leave the brain (logic) to you... Every time you need a loading state, you're back to manual useState and ternary hell. ❌ const [loading, setLoading] = useState(false) ❌ Manually adding the <Loader /> icon ❌ Handling the success/error text swap I’m building fscomp to fix this. Here is a preview of the Button Atom with built-in state intelligence. 🤔 Why this is different: - Built-in Logic: Pass state="loading" or "success" and the component handles icons, text-swaps, and disabling automatically. Take a look at the FSComp Button atom preview below. 🧑💻 <Button state="loading" loadingText="Saving..." /> Status: WIP. Currently refining the core atoms before the first 100 slots open. Devs: Would you use a library that handles micro-states for you? 👇 #BuildingInPublic #ReactJS #TailwindCSS #UIUX
To view or add a comment, sign in
-
🚀 Styled Components vs Emotion.js — A Performance Perspective When using CSS-in-JS libraries like styled-components or Emotion.js, we often focus on developer experience—but what about performance and bundle size? Here are some key takeaways from a practical comparison using a Next.js production build: 🔹 CSS-in-JS ships styles inside JavaScript, not separate CSS files 🔹 Even one styled component can noticeably increase bundle size 🔹 styled-components showed ~20% increase in first-load JS 🔹 Emotion.js performed slightly better, landing between plain CSS and styled-components 🔹 Real-world impact observed: ⏱️ 19% difference in Time to Interactive 🎨 28% difference in First Contentful Paint 📉 Drop in PageSpeed score ⚠️ Why it matters: Larger bundles = slower load times Slower pages affect SEO, user experience, and ad costs Runtime style generation can impact rendering & re-renders 💡 Recommendations If you need theming and dynamic styles → Emotion.js is a solid choice If you don’t need runtime styling → consider Linaria (build-time CSS extraction) Always measure performance—milliseconds matter 📌 Performance is not just about clean code—it’s about what we ship to the browser. Have you noticed performance differences with CSS-in-JS in your projects? Let’s discuss 👇 #React #JavaScript #WebPerformance #CSSinJS #Frontend #NextJS #StyledComponents #EmotionJS #WebDev
To view or add a comment, sign in
-
-
🎮 Built a Simon Says Game using HTML, CSS & JavaScript Ever played Simon Says as a kid? I rebuilt it for the web — and it turned into a great lesson in logic, state management, and user interaction. This project challenged me to think beyond static UI and focus on how users interact with applications in real time. 🔍 What this project demonstrates - JavaScript event handling & game logic - DOM manipulation and state tracking - CSS animations & visual feedback Building a fully interactive browser game 🚀 Key features 🎯 Increasing difficulty with each level 🟢 Random color sequence generation ✨ Button flash & click animations ❌ Game-over detection on wrong input 🏆 Highest score tracking (session-based) 📱 Responsive, mobile-friendly UI 🛠️ Tech stack - HTML5 – structure - CSS3 – styling & animations - Vanilla JavaScript – logic & interactivity This project strengthened my understanding of how frontend technologies work together to create engaging experiences — not just pages. 🔗 Play it here: 👉https://lnkd.in/dXJNJRGs Would love feedback or suggestions for improvements 👇 #JavaScript #WebDevelopment #Frontend #CodingJourney #LearningByBuilding #HTML #CSS #Projects #SimonSays #Portfolio
To view or add a comment, sign in
-
🚀 𝐖𝐡𝐚𝐭’𝐬 𝐜𝐨𝐦𝐢𝐧𝐠 𝐭𝐨 𝐂𝐒𝐒 𝐢𝐧 𝟮𝟬𝟮𝟲 A bunch of powerful new CSS features are landing that make building polished, interactive UIs easier and with less JavaScript than before. ✨ Customizable components: style things like <select> completely with CSS, no hacks. 🎛 Invoker & interest triggers: trigger dialogs, tooltips, and previews declaratively right in HTML/CSS. 🌀 Native carousel tools, ::scroll-button() and ::scroll-marker() help you build scrollable UI with just CSS. 📌 Anchored container queries let your UI adapt based on how the browser actually positions things (for example, flipping the style when a tooltip moves above vs below its anchor). 📊 Better interaction controls: things like scroll-state queries and sibling counting make dynamic styling easier without JS. 𝗛𝗲𝗮𝗱𝘀-𝘂𝗽: most of these features are new and currently available mainly in Chromium-based browsers, they’re not yet supported across all major browsers, so you’ll want to check compatibility before using them in production. 𝙎𝙤𝙪𝙧𝙘𝙚: https://lnkd.in/gaPHEECG #CSS #FrontendDevelopment #TechTrends #WebStandards #FrontEndTips
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development