Hi Jan.
Is it possible to enable the Controller after disabling?
I've tried it with this code sample. Console.log fires the states as expected.
The controller will be disabled, but never enabeld. Is there anything to do after
enabling? Like updating the scene?
Thanks for your help!
Stefan.
var waitForFinalEvent = function(){var b={};return function(c,d,a){a||(a="I'm a banana!");b[a]&&clearTimeout(b[a]);b[a]=setTimeout(c,d)}}();
function isBreakpoint( alias ) {
return $('.device-' + alias).is(':visible');
}
$(window).resize(function () {
waitForFinalEvent(function(){
if (isBreakpoint('md') || isBreakpoint('lg') ) {
//parallax_controller.enabled();
//parallax_controller.update();
//console.log ( "MD,LG: ", parallax_controller.enabled() );
} else {
//parallax_controller.enabled(false);
//console.log ( "MOBILE: ", parallax_controller.enabled());
}
}, 300, new Date().getTime())
});
Hi @house8 !
I had this issue too and was able to get it working by enabling/disabling the scene as opposed to the controller itself:
https://github.com/janpaepke/ScrollMagic/issues/117
hi @eballeste.
Thank you for your advice. I exactly figured out the same yesterday. ;)
This is working for me.
Another issue: I wanted to pack the scenes into an array to feed the controller at once, which is not working exactly like every single Scene with the Scene.addTo(controller) method.
The Array with scenes causes that every parallax background was moving without scrolling.
Thanks for your help.
Stefan.
I am having this issue also. I will try enabling/disabling the scenes instead of the controller.
need run update after change state of the controller.
controller.update(true);
$(window).on("resize", function(e) {
if ($(window).width() < 769 && controller.enabled()) {
controller.enabled(false);
} else if (!controller.enabled()) {
controller.enabled(true);
}
controller.update(true);
});
I think this should be said in the enabled parameter documentation.
Most helpful comment
need run update after change state of the controller.