0

The goal

Call Isotope inside an object.

The problem

By Google Chrome: Uncaught TypeError: Object [object Object] has no method 'isotope'.

The code

var mainResources = {
    // Execute this when the document is ready to go
    whenDocumentReady: function () {
        this.calculateResponsiveMeasures();

        jQuery("ul.products-list").isotope({
            itemSelector: "li",
            masonry: {
                gutterWidth: 15
            }
        });
    }
    [...]
}

I do not know what I have to do. By the way, thanks in advance. Cheers!

Guilherme Oderdenge
  • 4,935
  • 6
  • 61
  • 96
  • 1
    is your `isotope` library defined in the right place after jQuery is included? – Sushanth -- Jun 06 '13 at 20:07
  • @Sushanth-- Yes. Just to confirm, [look this image](http://i.imgur.com/WJ73jeS.jpg) (jQuery is the first) – Guilherme Oderdenge Jun 06 '13 at 20:08
  • @chiefGui, isotope is not jet defined. As @sushanth says. Or you misspelled it. E.g. `Isotope` – Richard Jun 06 '13 at 20:11
  • @Richard Thanks about your entry, but if I call the function in a `$(window).on("load", function() { ... })` it works fine. I guess the problem here is my object. – Guilherme Oderdenge Jun 06 '13 at 20:17
  • 1
    No, the problem here is the fact that your object is initialized, before isotope.. Just make sure you include the isotope.js file, before the file where your object is loaded. – Richard Jun 06 '13 at 20:18
  • 1
    You was right, @Richard. The **main.js** file was before **isotope.js**. Can you transform your comment into an answer to declare as resolved? Thank you very much! – Guilherme Oderdenge Jun 06 '13 at 20:37

1 Answers1

1

The problem here is the fact that your object is initialized, before isotope.. Just make sure you include the isotope.js file, before the file where your object is loaded.

Richard
  • 4,341
  • 5
  • 35
  • 55