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

issue: Broken on isotope 2.0 #15

Open
mikey0000 opened this issue May 16, 2014 · 16 comments
Open

issue: Broken on isotope 2.0 #15

mikey0000 opened this issue May 16, 2014 · 16 comments

Comments

@mikey0000
Copy link

replacing isoInit.element = element;
with
isoInit.element = $(element);

within the directive isotopeContainer fixes the problem.

@mikey0000
Copy link
Author

I can't seem to figure out how to set options for isotope? any chance you can tell me?

@mankindsoftware
Copy link
Owner

Hi,

I've got some new documentation at
http://mankind.com/angular-isotope/index.htmlhttp://mankind.com/angular-isotope/index.html.
Basically, you can emit an event, with the message passed on to Isotope.

Hope this helps.

Mark
Angular-Isotope Events
Angular-Isotope listens for the following events and passes the data to
Isotope's corresponding option or method command.

$scope.$emit('iso-option', {options};$scope.$emit('iso-method',
{name:methodName, params:optionalParameters};

Metafizzy Isotope APIs optionshttp://isotope.metafizzy.co/docs/options.html
| methods http://isotope.metafizzy.co/docs/methods.html

Example

$emit('iso-method', {name:'shuffle', params:null})

On Thu, May 15, 2014 at 5:36 PM, Michael Arthur notifications@github.comwrote:

I can't seem to figure out how to set options for isotope? any chance you
can tell me?


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-43282578
.

@anderskristo
Copy link

Mark, how do I add the masonry layout? Also an exempel with imagesLoaded.

@mikey0000
Copy link
Author

It should default to masonry as per the snapjs docs

On May 18, 2014 7:35:12 AM GMT+12:00, Anders Kristoffersson notifications@github.com wrote:

Mark, how do I add the masonry layout? Also an exempel with
imagesLoaded.


Reply to this email directly or view it on GitHub:
#15 (comment)

Sent from my Android phone with K-9 Mail. Please excuse my brevity.

@gablabelle
Copy link

@mankindsoftware @mikey0000 : like @anderskristo have asked I'd also like to see an example with imagesLoaded. For now I've added another directive to do the following or else my images overlaps.

  .directive('isotope', function($timeout) {
    return {
      restrict: 'A',
      link: function(scope, element) {
        $timeout(function() {
          angular.element(element).isotope({
            onLayout: function() {
              angular.element(element).imagesLoaded( function() {
                angular.element(element).isotope('reLayout');
              });
            }
          });
        });
      }
    };
  })

Maybe I'm doing something wrong?

Also, for the newbie coder that I am, seeing a working example of how "normal" isotope options translate to a iso-options-subscribe="my-iso-opts" and/or iso-method-subscribe="my-iso-method" would greatly help. How should I set and where should I put my-iso-opts and my-iso-method?

angular-isotope-gablabelle

FYI: My project is available at https://github.com/gablabelle/ng-portfolio

Many thanks for your time and help.

@mikey0000
Copy link
Author

@gablabelle I've also had the image overlapping issue, I fixed it by pre-loading the images before displaying isotope.

the other way to do the directive that might work is this

angular.module('app.directives').directive('imageonload', function() {
return {
    restrict: 'A',
    link: function(scope, element, attrs) {
        element.bind('load', function() {
          $(this) //do something with this
        });
    }
};
});

just place imageonload in the image tag and this will fire when the image has loaded

@gablabelle
Copy link

@mikey0000 I'm actually trying to lazyload the images not to preload them since I'll be having lots of them on this page. It works fine using imagesLoaded as described at http://isotope.metafizzy.co/appendix.html#imagesloaded

I just can't find a solution to make it work correctly with angular-isotope as it should.

@mikey0000
Copy link
Author

@gablabelle I think the best solution is if you know what the height and width is, is to set a loading image and set the height and width of each image, this will stop the overlap and will provide feedback that images are loading. another alternative is to lazyload one at a time and add them to the list as they are ready. I've never used isotope on its own so I can't really help in terms of visually understanding what your trying to achieve. I've downloaded your project to both take a look at your approach as I am facing similar issues.

@blowsie
Copy link

blowsie commented Jun 5, 2014

Is there plans to update the code to use isotope 2.0?

@nguyenDalex
Copy link

Up vote for isotope 2.0?

@langfors
Copy link

👍 mikey2000 solution at the top gets isotope 2.0 working for me.

@JonCognioDigital
Copy link

I was hoping that somebody would have found a solution to using imagesLoaded. Anybody got this to work yet?

@Papagoat
Copy link

This method works for me using isotope version 2.

// // ====================================================================================================
// // Isotope ImagesLoaded
// // ====================================================================================================

(function() {
    var app = angular.module('imagesLoaded', []);

    app.directive('imagesLoaded', function($timeout) {
        return {
            restrict: 'A',
            link: function($scope, $elem, $attr) {

                $timeout(function() {
                    $elem.isotope();

                    $elem.isotope('once', 'layoutComplete', function(isoInstance, laidOutItems) {
                        $elem.imagesLoaded(function() {
                            $elem.isotope('layout');
                            // console.log(isoInstance);
                        });
                    });
                }, 0);
            }
        };
    });
})();

Attach to your main module and add the directive to your element. eg,

<ul isotope-container images-loaded>

@cherchyk
Copy link

to @Papagoat 👍
Do you have example ImagesLoaded + angular-isotope + isotope >2 ???

I'm struggling hard to make it working.

@Papagoat
Copy link

Papagoat commented Jun 4, 2015

Hi @cherchyk, apologies for the late reply. Unfortunately I do not have an example. It's not too hard though. Just use the directive that I have posted above in your AngularJS application and apply the directive to the isotope container.

It's not perfect though. You will need to configure angular isotope to reLayout on scroll because the grid breaks when the images are loaded.

@thomask
Copy link

thomask commented Jan 15, 2016

+1

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