Git Product home page Git Product logo

broadwick-live's Introduction

There are two reasons behind using Locomotive Scroll -

  1. Simple Smooth Scroll, although it can be achieved using CSS and JS also
  2. Fixed elements scrolling while target is in view. I couldn't figure this one using JS and CSS. If I can, then I'll definitely remove Locomotive

The problems I faced while creating this -

  1. First and foremost, the biggest problem is that we cannot use window.scrollY and/or document.body.scrollTop, and so position fixed, relative, absolute won't work here
  2. Because of reason 1, I couldn't do the simple fixed navbar on scroll feature.
  3. Fixing elements on scroll is not that easy here, because you need to put the contents of the target and the fixed element in the same grid. And so, a lot of hardcoded values are used here.
  4. The documentation of locomotive scroll is pretty useless. The main thing that took me a lot of time to figure out is that every element that has data-scroll will have a progress property, which defines how much of the content is in view. This is the only way to check if the content is in view or not, since window and body scroll properties don't work here.

Things that are remaining -

  1. Responsiveness. I couldn't make it responsive, I don't feel like spending that amount of energy into this. Instead I'll work on other projects.
  2. Loading animation. I think I can do this using GSAP or Framer Motion. I'll do it probably.
  3. Fixing the navbar on scroll up and removing it on scroll down. I'm figuring this one right now.

Ideas I have right now regarding these problems

  1. Maybe there are some JS and CSS codes that I can get. If anyone can help me regarding this, it'll be highly appreciated.
  2. Maybe intersection observer combined with JS/CSS can help me do the fixed element scrolling. I dunno tho.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.