radiodraws
10/6/2017 - 8:49 AM

Animate sections appear javascript

Animate sections appear javascript


    var strAllSelectors = '.section-blocks .columns_c' +
      ', .text-img-block .wrap-columns';

    var $sectionBlock = $(strAllSelectors);
    //--comprobar si al seccion entra en pantalla
    $sectionBlock.each(function() {
      var $this = $(this);
      var box = $this.offset();
      if (box.top - 200 < $(window).height()) {
        setTimeout(function() {
          $this.addClass('animar');
        }, 1200);
      }
    });

    var animarsection = $sectionBlock.waypoint({
      handler: function(direction) {
        $(this).addClass('animar');
      },
      offset: '95%'
    });