未捕获的类型错误:无法读取未定义的属性“LayoutMode”

时间:2022-12-01 23:44:10

HI i am making my project using Isotope.js where i have to show my tiles in the horizontal manner, So i am following code

你好,我正在用同位素做我的项目。在js中,我必须以横向的方式显示我的块,因此我遵循代码

var winDow = $(window);
    // Needed variables
    var $container=$('.portfolio-box, .blog-box');
    var $filter=$('.filter');

    try{
        $container.imagesLoaded( function(){
            $container.show();
            $container.isotope({
                layoutMode: 'masonryHorizontal',
                masonryHorizontal: {
                    rowHeight: 50
                },

            });
        });
    } catch(err) {
    }

but unluckily it is not working , error on the console is

但不幸的是,它没有工作,控制台的错误是

1.    Uncaught TypeError: Cannot read property 'LayoutMode' of undefined
2.    Uncaught TypeError: undefined is not a function

Help is appreciable must

帮助是明显的必须

2 个解决方案

#1


5  

You're not including the isotope plugin on your page.

你的页面上没有包含同位素插件。

You need to include both isotope.pkgd.min.js and masonry-horizontal.js

你需要包含这两个同位素。js和masonry-horizontal.js


This is grabbed from your site. If you uncomment that line, you should be good.

这是从你的网站上抓取的。如果你不评论那句话,那你应该做得很好。

<!--<script type="text/javascript" src="js/jquery.isotope.min.js"></script>-->

#2


2  

I'm having the same problem and found something. The jquery-isotope never sets window.Isotope.LayoutMode. That's why it is undefined. If you don't use the jquery and just the regular one, you should not have this problem.

我也有同样的问题,发现了一些东西。jquery-同位素从不设置窗口。这就是为什么它没有定义。如果您不使用jquery而只使用常规jquery,则不应该出现这种问题。

I fixed it by include the layout-mode.js right after jquery.isotope.js, and just before the masonry-horizontal.js

我把它包括在布图模式。js jquery.isotope之后。在masonry- horizontaljs之前

#1


5  

You're not including the isotope plugin on your page.

你的页面上没有包含同位素插件。

You need to include both isotope.pkgd.min.js and masonry-horizontal.js

你需要包含这两个同位素。js和masonry-horizontal.js


This is grabbed from your site. If you uncomment that line, you should be good.

这是从你的网站上抓取的。如果你不评论那句话,那你应该做得很好。

<!--<script type="text/javascript" src="js/jquery.isotope.min.js"></script>-->

#2


2  

I'm having the same problem and found something. The jquery-isotope never sets window.Isotope.LayoutMode. That's why it is undefined. If you don't use the jquery and just the regular one, you should not have this problem.

我也有同样的问题,发现了一些东西。jquery-同位素从不设置窗口。这就是为什么它没有定义。如果您不使用jquery而只使用常规jquery,则不应该出现这种问题。

I fixed it by include the layout-mode.js right after jquery.isotope.js, and just before the masonry-horizontal.js

我把它包括在布图模式。js jquery.isotope之后。在masonry- horizontaljs之前