question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having a class like active on section in viewport only!!!

See original GitHub issue

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I’m always frustrated when […]

Describe the solution you’d like A clear and concise description of what you want to happen.

Describe alternatives you’ve considered A clear and concise description of any alternative solutions or features you’ve considered.

Additional context Add any other context or screenshots about the feature request here.


@locomotivemtl feedback below

Current progress for this issue

Please keep in mind we work on this library when we can. As a web agency with clients paying for their projects, we have priorities. Since those are enhancements and as long as we don’t need them in our own projects, they are not top priority.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
podrivocommented, Feb 29, 2020

data-scroll-section-inview is working great for me! I can use this to manipulate fixed elements in the page. Thanks!

2reactions
Jerek0commented, Feb 25, 2020

➡️ See the edited issue description for progress


In the meantime if you do not want any offset at all, I suggest you fork this library and play with the window.innerHeight factor on lines quoted above. Probably something like this

let offset = section.getBoundingClientRect().top - window.innerHeight - getTranslate(section).y;
let limit = offset + section.getBoundingClientRect().height + window.innerHeight;
Read more comments on GitHub >

github_iconTop Results From Across the Web

I want to Add class 'your-active-class' to section when near top ...
Few small problems but you're on the right track. Firstly, try using getBoundingClientRect().top - which should give you a px distance from ...
Read more >
Add class when in viewport - CodePen
It depends on Sass and Bourbon, so in addition to having either variety of Sass active, you'll need to import Bourbon too, like...
Read more >
How to Add Active Class in Javascript - YouTube
In this video tutorial, you will learn how to add active class in javascript.Source Code:https://www.fwait.com/how-to-add- active - class -in- ...
Read more >
Beginner's guide to media queries - Learn web development
For example, we might want to test for a min-width and orientation . The body text will only be blue if the viewport...
Read more >
Setting the active class - Vectorworks
If there are only a few classes, switch among classes with the Switch Active Layer/Class ; From the Organization dialog box, select the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found