dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent
http://photoswipe.com
MIT License
24.18k stars 3.31k forks source link

Safari for windows issues #1078

Open jtbr opened 8 years ago

jtbr commented 8 years ago

In testing with Safari for windows v4.0.3 (which I need to support because it's used by Adobe Lightroom), I found at least two significant issues with the photoswipe user interface. It otherwise looks pretty good. The issues:

1) Upon clicking anywhere in photoswipe, the image is dragged by the (already released) mouse. Clicking a second time does not stop the drag action. Clicking within the image does not zoom either.

2) Scrolling the underlying window (using the mouse wheel or the scrollbar) causes the image container to move, partially hiding the image (it hides more of the bottom of the image the farther you scroll down).

This can be seen by opening the gallery on photoswipe.com from Safari, and occurs even if mouseUsed is set to true upon initialization.

I wonder if some of this might be caused by hooks for the safari mobile browser catching in the desktop version.

jtbr commented 8 years ago

I am able to workaround issue number 1) by disabling dragging altogether. This is accomplished by replacing photoswipe.js:918-920 with

if(_options.allowDrag && !_oldIE) {
            framework.bind(self.scrollWrap, _downEvents, self); // no dragging for old IE
}

and adding an option allowDrag which defaults to true. While this works nicely on Safari, I notice that on modern browsers, the mouse pointers are misleadingly still showing a zoom icon and hand for dragging (neither of which will work), so I'm not submitting a pull request to add this option.

I am able to avoid issue 2) for the most part by calling the following jQuery before opening photoswipe:

$("html, body").scrollTop(0);

Then the image is not hidden partially hidden unless the user scrolls the window down again (which is possible because closeOnScroll doesn't appear to work either on this version of Safari). But at least the user will know what caused the image to be hidden in that case, and can undo it.