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

Isotope and flexible images #124

Open
culbrique opened this issue Sep 1, 2016 · 1 comment
Open

Isotope and flexible images #124

culbrique opened this issue Sep 1, 2016 · 1 comment

Comments

@culbrique
Copy link

culbrique commented Sep 1, 2016

Hi !

I'm using Isotope to display a lot of images and Unveil to load them correctly. But my layout is build with three different items dimensions. With just Isotope, it's working, but I can't get Unveil work on it. I have followed this topic : #85 but there is a weird technique with padding-bottom to size them.

I have built a Jsfiddle to show you my problem : http://fiddle.jshell.net/njnf86L6/8/
As you can see, on page load, everything is ok, but when you scroll, the images are overlaped.
I really don't know what to do.

Every help will be appreciated. Thanks in advance.

@culbrique
Copy link
Author

I found a weird solution to my problem.
This was my original script

$(document).ready(function () {
   var $container = $('#masonry').imagesLoaded( function() {
    $container.isotope({
        itemSelector: 'ul li'
    });
   });
    $("img").unveil(50, function() {
      $(this).load(function() {
        this.style.opacity = 1;
      });
    });
});

And I just moved the isotope imagesLoaded function into the unveil function like that

$(document).ready(function () {   
    $("img").unveil(50, function() {
      var $container = $('#masonry').imagesLoaded( function() {
        $container.isotope({
          itemSelector: 'ul li'
        });
     });
      $(this).load(function() {
        this.style.opacity = 1;
      });
    });
});

And it works perfectly ! I just added "transitionDuration: 0" to isotope function to make sure anything move during unveil is reaveling images. I hope this solution is strong enough but I don't see any mistake.

The updated jsfiddle here
http://fiddle.jshell.net/njnf86L6/10/

Unveil is really awesome, this plugin helped me many times.

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

1 participant