Skip to content

Force image height OR width like we want. #11

@Darknior

Description

@Darknior

For my part i use many images not all with same size ...
I only want to force the height to make them all biggest but not go out of the carrousel.
For this i change your fonction like this:

forcedImageHeightOnly: 0,   // Forced height only
forcedImageWidthOnly: 0,    // Forced width only

function forceImageDimensionsIfEnabled() {
  if (options.forcedImageWidth && options.forcedImageHeight) {
    data.itemsContainer.find('img').each(function () {
      $(this).width(options.forcedImageWidth);
      $(this).height(options.forcedImageHeight);
    });
  } else if (options.forcedImageHeightOnly) {
    data.itemsContainer.find('img').each(function () {
      $(this).height(options.forcedImageHeightOnly);
    });
  } else if (options.forcedImageWidthOnly) {
    data.itemsContainer.find('img').each(function () {
      $(this).width(options.forcedImageWidthOnly);
    });
  }
}

I think it can some other people ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions