static/js/js-old/js4.js
/**
   * Checks to see if the slide is visible enough.
   * elem = element to check.
   * type = The way to calculate how much is visible.
   * amountVisible = amount that should be visible. Either in percent or px. If
   *                it's not defined then all of the slide must be visible.
   *
   * Returns true or false
   */
Checks to see if the slide is visible enough.
elem = element to check.
type = The way to calculate how much is visible.
amountVisible = amount that should be visible. Either in percent or px. If
it's not defined then all of the slide must be visible.

Returns true or false
Checks to see if the slide is visible enough . elem = element to check . type = The way to calculate how much is visible . amountVisible = amount that should be visible . Either in percent or px . If it ' s not defined then all of the slide must be visible . Returns true or false
function viewsSlideshowCycleIsVisible(elem, type, amountVisible) {
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();
    var docViewLeft = $(window).scrollLeft();
    var docViewRight = docViewLeft + $(window).width();
    var elemTop = $(elem).offset().top;
    var elemHeight = $(elem).height();
    var elemBottom = elemTop + elemHeight;
    var elemLeft = $(elem).offset().left;
    var elemWidth = $(elem).width();
    var elemRight = elemLeft + elemWidth;
    var elemArea = elemHeight * elemWidth;
    var missingLeft = 0;
    var missingRight = 0;
    var missingTop = 0;
    var missingBottom = 0;
    if (elemLeft < docViewLeft) {
      missingLeft = docViewLeft - elemLeft;
    }
    if (elemRight > docViewRight) {
      missingRight = elemRight - docViewRight;
    }
    if (elemTop < docViewTop) {
      missingTop = docViewTop - elemTop;
    }
    if (elemBottom > docViewBottom) {
      missingBottom = elemBottom - docViewBottom;
    }
    if (type == 'full') {
      return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
      && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop)
      && (elemLeft >= docViewLeft) && (elemRight <= docViewRight)
      && (elemLeft <= docViewRight) && (elemRight >= docViewLeft));
    }
    else if(type == 'vertical') {
      var verticalShowing = elemHeight - missingTop - missingBottom;
      if (amountVisible.indexOf('%')) {
        return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible));
      }
      else {
        return (verticalShowing >= parseInt(amountVisible));
      }
    }
    else if(type == 'horizontal') {
      var horizontalShowing = elemWidth - missingLeft - missingRight;
      if (amountVisible.indexOf('%')) {
        return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible));
      }
      else {
        return (horizontalShowing >= parseInt(amountVisible));
      }
    }
    else if(type == 'area') {
      var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom);
      if (amountVisible.indexOf('%')) {
        return (((areaShowing/elemArea)*100) >= parseInt(amountVisible));
      }
      else {
        return (areaShowing >= parseInt(amountVisible));
      }
    }
  }
function viewsSlideshowCycleIsVisible ( elem , type , amountVisible ) { var docViewTop = $ ( window ) . scrollTop ( ) ; var docViewBottom = docViewTop + $ ( window ) . height ( ) ; var docViewLeft = $ ( window ) . scrollLeft ( ) ; var docViewRight = docViewLeft + $ ( window ) . width ( ) ; var elemTop = $ ( elem ) . offset ( ) . top ; var elemHeight = $ ( elem ) . height ( ) ; var elemBottom = elemTop + elemHeight ; var elemLeft = $ ( elem ) . offset ( ) . left ; var elemWidth = $ ( elem ) . width ( ) ; var elemRight = elemLeft + elemWidth ; var elemArea = elemHeight * elemWidth ; var missingLeft = 0 ; var missingRight = 0 ; var missingTop = 0 ; var missingBottom = 0 ; if ( elemLeft < docViewLeft ) { missingLeft = docViewLeft - elemLeft ; } if ( elemRight > docViewRight ) { missingRight = elemRight - docViewRight ; } if ( elemTop < docViewTop ) { missingTop = docViewTop - elemTop ; } if ( elemBottom > docViewBottom ) { missingBottom = elemBottom - docViewBottom ; } if ( type == 'full' ) { return ( ( elemBottom >= docViewTop ) && ( elemTop <= docViewBottom ) && ( elemBottom <= docViewBottom ) && ( elemTop >= docViewTop ) && ( elemLeft >= docViewLeft ) && ( elemRight <= docViewRight ) && ( elemLeft <= docViewRight ) && ( elemRight >= docViewLeft ) ) ; } else if ( type == 'vertical' ) { var verticalShowing = elemHeight - missingTop - missingBottom ; if ( amountVisible . indexOf ( '%' ) ) { return ( ( ( verticalShowing / elemHeight ) * 100 ) >= parseInt ( amountVisible ) ) ; } else { return ( verticalShowing >= parseInt ( amountVisible ) ) ; } } else if ( type == 'horizontal' ) { var horizontalShowing = elemWidth - missingLeft - missingRight ; if ( amountVisible . indexOf ( '%' ) ) { return ( ( ( horizontalShowing / elemWidth ) * 100 ) >= parseInt ( amountVisible ) ) ; } else { return ( horizontalShowing >= parseInt ( amountVisible ) ) ; } } else if ( type == 'area' ) { var areaShowing = ( elemWidth - missingLeft - missingRight ) * ( elemHeight - missingTop - missingBottom ) ; if ( amountVisible . indexOf ( '%' ) ) { return ( ( ( areaShowing / elemArea ) * 100 ) >= parseInt ( amountVisible ) ) ; } else { return ( areaShowing >= parseInt ( amountVisible ) ) ; } } }
Checks to see if the slide is visible enough.
Checks to see if the slide is visible enough .
// Get the top and bottom of the window; // Get the top, bottom, and height of the slide; // Calculate what's hiding in the slide. // Find out how much of the slide is missing from the left. // Find out how much of the slide is missing from the right. // Find out how much of the slide is missing from the top. // Find out how much of the slide is missing from the bottom. // If there is no amountVisible defined then check to see if the whole slide // is visible. // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount. // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount. // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount.