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

broken in WordPress & srcset #1037

Closed
leanda opened this issue Feb 14, 2016 · 5 comments
Closed

broken in WordPress & srcset #1037

leanda opened this issue Feb 14, 2016 · 5 comments

Comments

@leanda
Copy link

leanda commented Feb 14, 2016

Hi

I have a really strange problem with isotope, infinite scroll and imagedLoaded on iOS 9 (iPhone). This works fantastically in every other browser except for mobile safari. Where after maybe the second or third set of posts loads it's almost as if imagesLoaded stops working and a few posts start to overlap again.

I've thrown everything at it this weekend and still can't figure out what's going on.

Thanks

`$(window).load(function () {

var $container = $('.container'); //The ID for the list with all the blog posts

$container.imagesLoaded(function(){
$container.isotope({ //Isotope options, 'item' matches the class in the PHP
    itemSelector : '.item',
    layoutMode : 'masonry',
    stamp: '.stamp',
    masonry: {
        gutter: '.gutter-sizer'
    }
});
});

$container.infinitescroll({
    "nextSelector":".nav-links .nav-previous a",
    "navSelector":".paging-navigation",
    "itemSelector":".item:not(.stamp, .main-filter-navigation, .intro-about, .intro-written, .intro-brought, .intro-interpreted)",
    "bufferPx": "500",
    loading: {
        finishedMsg: 'No more items to load.',
        img: 'http://i.imgur.com/qkKy8.gif'
    }
},

function ( newElements ) {
   var $newElems = jQuery( newElements ).css({ opacity: 0 }); // hide to begin with

  $('.container').imagesLoaded( function() {
  $newElems.fadeIn().delay(40); // fade in when ready
  $container.isotope( 'insert', $newElems );
  });
 }
 );
});`
@leanda
Copy link
Author

leanda commented Feb 18, 2016

I think I've tracked this down to be an issue with imagesLoaded and the new srcset responsive images introduced in WordPress 4.4

If I disable responsive image support using a filter in the functions.php file which removes the srcset attribute from the images then everything loads fine on mobile safari.

Is there a better way to fix this?

Thanks

@desandro desandro changed the title isotope, infinite scroll imagedLoaded and iOS 9 broken in WordPress & srcset Feb 18, 2016
@desandro
Copy link
Member

Thanks for reporting the issue. Sorry, but I don't think there's a better fix. imagesLoaded does not support srcset. See desandro/imagesloaded#175

@leanda
Copy link
Author

leanda commented Feb 18, 2016

Thanks for confirming, any chance it will in the future?

@desandro
Copy link
Member

Of course! Hoping for a valiant Pull Request to make it happen.

@leanda
Copy link
Author

leanda commented Feb 18, 2016

Thanks, awesome! Will watch this space.

@leanda leanda closed this as completed Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants