Giter Site home page Giter Site logo

lcdsantos / menuspy Goto Github PK

View Code? Open in Web Editor NEW
303.0 303.0 38.0 485 KB

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

JavaScript 100.00%
es6 javascript javascript-library menu menuspy nav navigation navigation-menus-highlight scrollspy

menuspy's People

Contributors

busybox11 avatar kirbee-parsons-hs avatar lcdsantos avatar paldepind avatar qathom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

menuspy's Issues

'unexpected token import'

I think it needs transpiling, right?

Could you possibly add this to the README.md? Looks like even the latest Version of Chrome doesn't support import:

screen shot 2017-09-06 at 17 31 15

Conflict with VueJS

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.

New option: change the parent selector

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.

Can't add an offset to use it with a fixed navbar

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:

image

side-menu/ height to 100vh

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;
}

How to refresh/update calculations ?

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.

Provide a destroy method

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.

Smooth scrolling option

I wonder about such an option.
It doesn't seem to be possible with a callback as well though.
Thanks

Feature Request: Add Callback: When switching to NO "active" element

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:

  • Have I boiled this down correctly?
  • Is there an alternate method, that I haven't thought of, to accomplish the same? (I have a feeling this is the case. If true: Sorry in advance.)
  • Possible Feature Request: Have the callback also fire when MS switches from an active element to no active element.

Thanks!

Option to turn off anchors?

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.

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.