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

Add destroy or reset method #32

Open
HugoHeneault opened this issue Apr 20, 2015 · 7 comments
Open

Add destroy or reset method #32

HugoHeneault opened this issue Apr 20, 2015 · 7 comments

Comments

@HugoHeneault
Copy link

Hello,

Thanks for your great plugin!
I'd like to have a method to reset all the midnight's stuff :

    $('.nav').midnight('destroy');

could be great. :)

@yayromina
Copy link

Yes please!

@gjhead
Copy link

gjhead commented Aug 7, 2016

Anyone have any success adding a destroy method?

@benjamenjohnsondev
Copy link

benjamenjohnsondev commented Nov 13, 2017

I know it's over two years since this was requested... but this is 100% needed.

I have a logo I want to midnightjs - but only when scroll position reaches a certain point gonna have to hack this functionality in myself 👎

@HugoHeneault
Copy link
Author

If you hack it by yourself, don't forget to let a comment here saying what you did. Or better, open a PR :)

@RobertoGonzalez
Copy link
Member

@benjamenhogben @HugoHeneault I'd be happy to accept a PR with this feature.
I'm guessing the destroy() method only needs to clean up all the bindings (mostly the requestAnimationFrame and resize ones) and roll back the markup changes.

@jordan26
Copy link

+1

@jackfowler
Copy link

I was looking for a destroy method because I needed to reinit on ajax page change. While it isn't a destroy method, the refresh method did the trick for me, which you can access by doing the following. $('.header').midnight('instance').refresh();
Thought it might be helpful for someone!
Credit to @tkatchenko for figuring this out.

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

7 participants