I have built a test site using Foundation 6 Accordion Menu and Magellan: http://studiospaces.vlvtn.com/test
I would like the top level headers to expand and collapse when you reach the relative sections (eg #header-1, #header-2) on scroll.
It's a little out of my capabilities, and any help in the right direction will be hugely appreciated!
Thank you in advance.
Evan.
Good question...
Had a play with this and I think I have cracked it, hopefully the comments will make sense.
There is an event fired by magellan
update.zf.magellanthat I have used. This fires pretty much on mouse scroll.As Magellan adds an
activeclass the the current active anchor I am getting this element and comparing it to a storedlastActivevariable. If they are different then the section has updated.Then I check if the current active anchor is a child of a sub menu, if not I close all open menus. If it is a child I open its parent.
You can open and close Accordion menus using the methods described on the Accordion docs page
This method relies on classes so it may not work for your setup. You could use the current # in the url to detect changes if using deep linking.