Skip to content
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

Gallery images skipped in iOS #447

Closed
thehappybit opened this issue May 5, 2014 · 13 comments
Closed

Gallery images skipped in iOS #447

thehappybit opened this issue May 5, 2014 · 13 comments

Comments

@thehappybit
Copy link

Hi,

we've been noticing a weird behavior on iOS. If I have, say, 8 images in a gallery, they load correctly on desktop, and clicking on the navigation arrows indeed makes the gallery go to the next or prev image.

On iOS though, clicking on the "next" arrow, makes the gallery skip from the 1st image to the 3rd; clicking on the image (navigateByImgClick: true) works correctly, so does the API method .next().

@mjcampagna
Copy link

Are you using your own buttons with on("click")? If so, then you need to
first uncouple the click event before firing the subsequent event, using
.off("click").on("click").

@thehappybit
Copy link
Author

No we're using the default ones, but we might switch to our own in order to make things work as intended. Still probably needs fixing though.

@mjcampagna
Copy link

Strange. I've not had a problem using Magnific on iOS. If you posted a link
to you implementation, it might be helpful.

@thehappybit
Copy link
Author

A'ight so the page that's having the problem would be this one: http://thbthemes.com/demo/one/works/work-2/

Given a target element, this is the implementation (ie. which options we're passing to Magnific Popup):

delegate: "a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], a.mfp-iframe",
gallery:{
    enabled:true
}

@thehappybit
Copy link
Author

We've made a few tests about this issue, and the only explanation that we've been able to find is that clicking on the next/prev arrows actually fires twice, one time on the "click" event, and then another on the "mfpFastClick" event.

For now we could solve this by adding a new callback function on open:

open: function() {
    var supportsFastClick = Boolean( $.fn.mfpFastClick ),
        evt = supportsFastClick ? "mfpFastClick" : "click",
        mfp = this;

    $( ".mfp-arrow" ).off( "click" );
    $( ".mfp-arrow" ).off( "mfpFastClick" );

    $( ".mfp-arrow-left" ).on( evt, function() {
        mfp.prev();
        return false;
    } );
    $( ".mfp-arrow-right" ).on( evt, function() {
        mfp.next();
        return false;
    } );
}

@purplespider
Copy link

I'm seeing this issue too. What's the recommended fix?

@dcooney
Copy link

dcooney commented Nov 14, 2014

Having the same issue here... I thought it was a double click event or something so I turned off navigateByImgClick but that didn't solve the issue.

Any ideas?

@scottshefler
Copy link

Still having this issue as well, any updates on a fix?

@sarahsehr
Copy link

Also having this issue on iOS only. Is there any update on this issue?

@vesrah
Copy link

vesrah commented Aug 10, 2015

I'm also curious if there is a fix or hack for making this work properly.

@despecial
Copy link

Same problem here. A fix would be awesome!

@RickMarkus
Copy link

Confirmed unexpected behavior in our build as well.

@Emirii
Copy link

Emirii commented Feb 20, 2016

This issue is still alive and well in the latest version. It does it on a non-bootstrap template, however it works fine on a bootstrap template. I'm not sure what the issue would be caused by.

The above solution thehappybit posted disabled the left/right arrows on all other browsers/devices, but the iPad began to work beautifully. :(

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

No branches or pull requests

10 participants