lcdsantos / menuspy Goto Github PK
View Code? Open in Web Editor NEWA JavaScript library to make navigation menus highlight the item based on currently in view section.
Home Page: https://leocs.me/menuspy/
License: MIT License
A JavaScript library to make navigation menus highlight the item based on currently in view section.
Home Page: https://leocs.me/menuspy/
License: MIT License
As soon as I initiate VueJS on any of the ancestor elements of the nav, the active
class is no longer added to the active item. The hash is still updated.
https://codepen.io/paweldecowski/pen/VRxawX
Try commenting out VueJS initialisation and it works fine. But with it, it doesn’t work.
That could be useful to see all section title even if not active as it is not intuitive to have no title...
Hello. I had this markup and plugin worked incorrect nav > a
After I add markup from example it begin to work.
Is this structure is mandatory?
Is it possible to add to your options a new one to select the parent selector ?
Right now, select the page's height but it could be better to select a container.
For exemple, if you want a full page height (100vh) and in this page, you have a container with a "overflow: scroll-y". So you should select the height of this container and make your maths with this because the page is not scrolling but the content of your container is.
Great job for your package dude.
Hi, I don't know if you are going to reply to this, but your library is very helpful to me actually, I'm new to JS so maybe is a fault of mine, so. I tried to put an offset every time a clicked but the navbar conflicts with the start of the div that I want to see, how can I fix this or is it an issue?
Example in the image:
Height is auto, click error
Hello!
Awesome scroll! But customizing height to 100vh on section properties broke the navigation. Only works with 1080px? I just want to fill exact 100% browser height
Original:
section {
height: 1080px;
color: #FFF;
text-align: center;
}
Custom:
section {
height: 100vh;
color: #FFF;
text-align: center;
}
I am using menuspy
with scrollmagic
library. Since scrollmagic
creates pinned scenes, it changes the height of each scene when one is activated by scrolling to its position.
I would like to have menuspy
update its calculations when a scene is activated, because right now it is not aware of changed dimensions and it goes through whole navigation while I am basically just scrolling through one of the sections.
I can put up an online demo of needed.
Hi there,
When I pin a section using gsap, I believe it's causing MenuSpy to have trouble calculating when an ID hits the top of the viewport.
Here's a minimal codepen demo: https://codepen.io/scallemang/pen/NWgaNVv. As you'll see, once we hit the 'Pinned 1' section, following sections become active earlier than they should.
Do you have any suggestions on how I could resolve this? Thank you so much in advance.
Hi,
There is a problem after page refresh
How to reproduce :
https://leocs.me/menuspy/examples/sidemenu.html
click on the latest bullet (section-3)
refresh the page
click on any other bullet let say section-2
the section title 3 stay active while section are changing
I have a SPA and I don't want Menuspy on other pages beside where I exactly put it.
Right now, even if I navigate from the page where I required menuspy, it still exist.
Please provide a method to destroy menuspy.
I wonder about such an option.
It doesn't seem to be possible with a callback as well though.
Thanks
Hi,
MenuSpy is great. Very performant and easy to use, as promised!
I implemented the Lavalamp effect (from the example) and that was pretty easy too.
But I ran into a snag when I needed to hide.lavalamp
in the condition where no menu item is active. In my case, MS had removed .active
for all menu items, but the .lavalamp
remains in its last state (width
and height
set to the values from lastInViewElm
).
I can't think of how to effect this remote item (i.e.: Not nested inside of an .active
element or under the direct control of MS) in this case since the MS callback only fires when a new active element is assigned (as per the Docs and Source).
So I've been trying to figure out how to detect when no element is active without performance implications (i.e.: Not resorting to an on scroll handler and checking repeatedly for ms.lastInViewElm == null
).
Questions:
Thanks!
Hello. Am I able to turn off hash anchors changes entirely? I experience weird behavior with it. I am using menuspy
together with moveto
.
For example, hashTimeout: 0
does not work at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.