jeudi 7 juillet 2016

pass in DOM element to setClassToggle


I'm trying to pass in a DOM element that I get with jquery into the setClassToggle(element, class), but I keep getting this error. What am I missing here?

(ScrollMagic.Scene) -> ERROR calling method 'setClassToggle()': Invalid element supplied.

jsfiddle

      <div class="grid-item" data-parallax="bouble">
        <div class="container quote start" id="first">
          <h2>"</h2>
          <p>Vestibulum vitae congue nibh. Aliquam erat volutpat. Proin pretium mauris a quam molestie porttitor. Nulla vel molestie enim. Aenean suscipit cursus volutpat.</p>
        </div>
      </div>



  var parallaxClass = $(this).data('parallax');
  var element = $(this).find('.container');

  if (parallaxClass === 'bouble') {
    new ScrollMagic.Scene({
        triggerElement: this,
        triggerHook: 0.7
      })
      .addIndicators()
      .setClassToggle(element, parallaxClass)
      .addTo(controller);
  }

Aucun commentaire:

Enregistrer un commentaire