Aerolab/midnight.js

resetting data-midnight values via javascript

benbonnet opened this issue · 2 comments

— not a bug/issue —

Let's say for example in a single section, you have a fullscreen horizontal slideshow, and that depending on which slide is the current, you'd want to have a different class on your fixed-midnight-header (first slide i ant the blue header, second slide i want the white one, etc…)

I was then wondering if something like "refreshing" the data-midnights values via javascript would be possible ? Or if it was somehow available

In another approach, can it be triggered somehow via javascript ? Somehow like switching the midnight-header via some javascript command without scrolling

@bbnnt This seems like a good idea for massive sliders (adding a horizontal effect as well as the vertical one).
Right now there's no way of switching the class nicely in that specific case. While a command to recalculate all sections could be added to the API, we'd need to rework the plugin to make it actually look good (with appropriate animations and almost no lag).

I'm keeping this as a potential enhancement. Thanks for the suggestion!

Like adding data-midnight to the divs contained in the main one, that would affect the menu

But you got the idea! I was not sure to make it clear.

Tried to play around in the console (changing the data-midnight manually, then re-firing some $("my class").midnight() ) with no success (: )
I'll stay tuned for this one !
thx for your answer