SeeportChecker how to remove the class?



  • With a plastic view, the view-Checker adds a class to the block when it turns out in the field of the screen.

    jQuery(document).ready(function() {
      jQuery('.block').addClass("hidden").viewportChecker({
        classToAdd: 'visible animated rubberBand',
        offset: 100
      });
    });
    

    How to remove the class when the block is outside the screen, so that when it comes back to the field of vision, it's animated as it is for the first time.



  • https://github.com/dirkgroenen/jQuery-viewport-checker#options

    There's an option for that.

    $('.dummy').viewportChecker({
       ...
       removeClassAfterAnimation: false, // Remove added classes after animation has finished
       ...
    });
    

    Or use the attributes.

    <div data-vp-add-class="random"></div>          > classToAdd
    <div data-vp-remove-class="random"></div>       > classToRemove
    <div data-vp-remove-after-animation="true|false"></div>      > Removes added classes after CSS3 animation has completed
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2