Having a class like active on section in viewport only!!!
See original GitHub issueIs 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
- Append
data-scroll-section-inview
when a section is “visible” - Add ability to define the offset for when a section is considered “visible”. Around here: https://github.com/locomotivemtl/locomotive-scroll/blob/48e90230d001f41a27758bc95afe2ea8199659cf/src/scripts/Smooth.js#L427-L428 Maybe rename
offset
&limit
tostart
&end
for clarity? 🤔
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:
- Created 4 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
data-scroll-section-inview
is working great for me! I can use this to manipulate fixed elements in the page. Thanks!➡️ 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