ImgCenter | Options / API

Below are the options available with the ImgCenter jQuery Plugin.

  • parentSteps: number (0 by default) - Climbs up the number of parents elements specified starting from the current element, then applies the centering code based on that element.
  • scaleToFit: true or false (true by default) - Will size up (or down) the image to fill out the parent element if the image is too small while keeping proper centering.
  • centerVertical: true or false (true by default) - Will vertically center the image if set to true.
  • complete: callback function - Custom function that is run after each image has centering applied to it.
  • start: callback function - Custom function that is run only once, before image centering begins.
  • end: callback function - Custom function that is run only once, after image centering finishes on all images.