Skip to content

medium-image-zoom affect the image display #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tjx666 opened this issue Jan 26, 2025 · 3 comments
Open

medium-image-zoom affect the image display #817

tjx666 opened this issue Jan 26, 2025 · 3 comments
Assignees
Labels

Comments

@tjx666
Copy link

tjx666 commented Jan 26, 2025

With Zoom component:

import Zoom from 'react-medium-image-zoom';
import 'react-medium-image-zoom/dist/styles.css';

function App() {
  return (
    <div
      style={{
        margin: '20px',
        height: '100px',
        width: '100px',
        border: '2px solid red',
      }}
    >
      <Zoom>
        <img
          src="https://cdn.artiffuse.ai/generations/images/mu8ADtP5h9V0KcIHFoUEA_576x1024_20250122_230143_raw.webp"
          style={{
            maxWidth: '100%',
            maxHeight: '100%',
            objectFit: 'contain',
          }}
        />
      </Zoom>
    </div>
  );
}

export default App;

image height overflow:

Image

No Zoom component, the image fit the div size:

Image

online reproduce: https://stackblitz.com/edit/vitejs-vite-hgyeoboh?file=src%2FApp.tsx

@rpearce
Copy link
Owner

rpearce commented Jan 28, 2025

Hi, I'll check this out when I get some time! Thanks for the report.

@YanceyOfficial
Copy link

Hi, I found a solution, If you use TailwindCSS, you can add the follows code in your globals.css file to enforce the Zoom container has full width and full height.

@layer utilities {
  
  [data-rmiz] {
    @apply w-full h-full;
  }

  [data-rmiz-content] {
    @apply w-full h-full;
  }
}

@rpearce
Copy link
Owner

rpearce commented Apr 21, 2025

I'm sorry I haven't gotten to this yet. It seems like a legit issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants