francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.58k stars 160 forks source link

Auto closed on iOS safari browser #181

Open WinmezzZ opened 2 years ago

WinmezzZ commented 2 years ago

Bug description

When I clicked image on iOS safari browser , it show one second then auto closed but google and edge is ok, so do with any PC browser

How to reproduce

A list of the steps to reproduce the bug.

  1. code:

    useEffect(() => {
    if (typeof window === 'undefined') return;
    
    const zoom = mediumZoom('article .markdown img', {
      scrollOffset: 0,
      background: 'rgba(25, 18, 25, .9)'
    });
    
    return () => {
      zoom.detach();
    };
    }, []);
  2. Click on the image

Expected behavior

only turn off the preview when I trigger it

Reproducible example

[my site](my site:The second picture)

Environment

WinmezzZ commented 2 years ago

https://user-images.githubusercontent.com/40154766/132786386-d8d3f9c0-bf4b-42f3-a171-682e7786c3f9.MOV

It looks like Safari automatically adjusts the window