-
Notifications
You must be signed in to change notification settings - Fork 67
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
Stop after completed #27
Comments
Yes, that's the general recommendation @mrkenng. Bear in mind that you can call the stop outside the
|
Here's it what I am attempting: var morphistAnim = $("#fadeInOut").Morphist({ animateIn: "fadeIn", animateOut: "fadeOut", speed: 2000 }); var data = morphistAnim.data("plugin_Morphist"); if (window.matchMedia("(min-width: 48em)").matches){ $("#fadeInOut").addClass('morphist'); data.start(); } else { data.stop(); $("#fadeInOut").removeClass('morphist'); } $(window).resize(function() { var morphistAnim = $("#fadeInOut").Morphist({ animateIn: "fadeIn", animateOut: "fadeOut", speed: 2000 }); var data = morphistAnim.data("plugin_Morphist"); console.log(data); if (window.matchMedia("(min-width: 48em)").matches){ $("#fadeInOut").addClass('morphist'); data.start(); } else { data.stop(); $("#fadeInOut").removeClass('morphist'); } }); Narrow width before breakpoint should be no Morphist. Once breakpoint is reached, apply and run Morphist animation. The opposite should work if viewport width goes back down to narrow. I'm close, but getting TypeError t.start is not a function when viewport gets wider and passes the breakpoint. |
I believe something like the above should work. Haven't actually tested it. |
Thanks! I'll give it a run and get back to you here. |
Doesn't seem to be working. Just plays upon load - below the breakpoint - as if I am just simply initializing it. Default stop isn't working. Continues to work after resize. |
If anyone needs it, I was able to stop it from looping with this code:
|
Is there a way to stop the loop? I tried using complete function but I guess that is for each item after completed am I right?
The text was updated successfully, but these errors were encountered: