Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ar-rm opened this issue Nov 28, 2018 · 0 comments
Open

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

ar-rm opened this issue Nov 28, 2018 · 0 comments

Comments

@ar-rm
Copy link

ar-rm commented Nov 28, 2018

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant