Skip to content

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

@ar-rm

Description

@ar-rm

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions