src/boxzilla.js
function checkHeightCriteria() {

  var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;
  scrollY = scrollY + window.innerHeight * 0.9;

  boxes.forEach(function(box) {
      if( ! box.mayAutoShow() || box.triggerHeight <= 0 ) {
          return;
      }

      if( scrollY > box.triggerHeight ) {
          // don't bother if another box is currently open
          if( isAnyBoxVisible() ) {
              return;
          }

          // trigger box
          box.trigger();
      } 
    
      // if box may auto-hide and scrollY is less than triggerHeight (with small margin of error), hide box
      if( box.mayRehide() && scrollY < ( box.triggerHeight - 5 ) ) {
          box.hide();
      }
  });
}
function checkHeightCriteria() {

  var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;
  scrollY = scrollY + window.innerHeight * 0.9;

  boxes.forEach(function(box) {
      if( ! box.mayAutoShow() || box.triggerHeight <= 0 ) {
          return;
      }

      if( scrollY > box.triggerHeight ) {
          // don't bother if another box is currently open
          if( isAnyBoxVisible() ) {
              return;
          }

          // trigger box
          box.trigger();
      } 
    
      // if box may auto-hide and scrollY is less than triggerHeight (with small margin of error), hide box
      if( box.mayRehide() && scrollY < ( box.triggerHeight - 5 ) ) {
          box.hide();
      }
  });
}
function checkHeightCriteria ( ) { var scrollY = scrollElement . hasOwnProperty ( 'pageYOffset' ) ? scrollElement . pageYOffset : scrollElement . scrollTop ; scrollY = scrollY + window . innerHeight * 0.9 ; boxes . forEach ( function ( box ) { if ( ! box . mayAutoShow ( ) || box . triggerHeight <= 0 ) { return ; } if ( scrollY > box . triggerHeight ) { // don't bother if another box is currently open if ( isAnyBoxVisible ( ) ) { return ; } // trigger box box . trigger ( ) ; } // if box may auto-hide and scrollY is less than triggerHeight (with small margin of error), hide box if ( box . mayRehide ( ) && scrollY < ( box . triggerHeight - 5 ) ) { box . hide ( ) ; } } ) ; }
check triggerHeight criteria for all boxes
check triggerHeight criteria for all boxes