0

I have added and configured the Isotope jQuery in Magento 2.3.3. But, its working and showing error as below:

Uncaught TypeError: $(...).isotope is not a function

I have tried all the solutions but none of them are worked.

Have anyone an idea how to configure Isotope js in Magento2?

requirejs-config.js

enter image description here

enter image description here

1
  • <script type="text/javascript"> try this Jan 7, 2020 at 7:17

3 Answers 3

0

in your requirejs-config.js try this one:

var config = {

    map: {
        '*': {
            'isotope': 'Magento_Theme/js/isotope.pkgd'
        }
    },

    shim: {
        'isotope': {
            deps: ['jquery']
        }
    }
};

Your other js code looks fine. After that you need to check if your isotope.pkgd.js is loading in DOM. if it is going in 404 then you need to check path of isotope.pkgd.js

2
0

Please Try this way

var config = {

    map: {
        '*': {
            'isotope': 'Magento_Theme/js/isotope.pkgd'
        }
    },

    shim: {
        'isotope': {
            deps: ['jquery']
        },
    }
};

You miss the Talk break in your js file

0

you can use this in your template

<script type="text/javascript">

    require( [ 'require', 'jquery', 'isotope' ],
        function( require, $, Isotope ) {
            // require jquery-bridget, it's included in isotope.pkgd.js
            require( [ 'jquery-bridget/jquery-bridget' ],
                function( jQueryBridget ) {
                    // make Isotope a jQuery plugin
                    jQueryBridget( 'isotope', Isotope, $ );
                    // now you can use $().isotope()
                    $('.grid').isotope({
                        // ..your code
                    });
                    
                }
            );
        });
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.