janpaepke / ScrollMagic

The javascript library for magical scroll interactions.
http://ScrollMagic.io
Other
14.9k stars 2.17k forks source link

cant add more than one class to setClassToggle #483

Open saltnpixels opened 8 years ago

saltnpixels commented 8 years ago

I tried adding multiple classes and it doesnt work this an error.

The token provided ('flipInX flipOutX') contains HTML space characters, which are not valid in tokens. on: .setClassToggle('.phone', 'flipInX flipOutX')

guymeyer commented 8 years ago

+1

Ihatetomatoes commented 8 years ago

If you are using GSAP you can use the .set() method and add multiple classes that way.

Here is a demo on CodePen.

jarrodmedrano commented 8 years ago

+1 The comments in Scrollmagic.js are wrong.

This doesn't work.

Ihatetomatoes commented 8 years ago

Have you tried the .set method using GSAP? You only need the TweenLite to use the .set method.

estevancarlos commented 7 years ago

Same here.

estevancarlos commented 7 years ago

So this bug is a dealbreaker for me. Does anyone recommend an alternative library?

tony commented 7 years ago

This behavior surprised me.

While it's not a deal breaker.

I would expect multiple uses of setClassToggle() to append behaviors to a controller.

tony commented 7 years ago

@estevancarlos FYI, if you're using jQuery with ScrollMagic, you have a bit more flexibility since you can do multiple selectors:

https://api.jquery.com/multiple-selector/

In order words:

   new $.ScrollMagic.Scene(options)
      .duration(100)
      .setClassToggle(
        "a[href='moo'] ~ ul,a[href='moo']",
        "is-active"
      );
chiholiu10 commented 6 years ago

Example of how to trigger multiple id's at the same time

new ScrollMagic.Scene({ triggerElement: '#intro', triggerHook: 'onLeave' }) .on('enter leave', function () { $('#nav-bar').toggleClass('background-black'); $('#threeAnim').toggleClass('display-none'); }) .addTo(controller);