I am working on magento 2 and i want to open popup in my product detail page. But i have found problem with jquery issue and its not come every time.

Here is my requirejs-config.js

var config = {
    map: {
        '*': {
            jQuerylib: 'Magento_Catalog/js/jquery-1.12.5.min',
            colorbox: 'Magento_Catalog/js/jquery.colorbox-min',

And my js function on wrapper.phtml

requirejs(['jquery','domReady!','colorbox'], function(jQuery){

    jQuery( ".scustomization a" ).click(function() {

                width: "90%",
                height: "90%",
                iframe: true,
                href: _url + coString,
                opacity: 0.6,
                escKey: false,
                overlayClose: false,
                onComplete: function() {
                        var theframe = jQuery('#colorbox').find('iframe')[0];
                        theframe.src = _url + coString + "&t=" + d.getTime();
        return false;


I have error like bellow enter image description here

  • I am creating custom theme and location custom/theme/Magento_Catalog/templates/product – Jalpesh Patel Dec 16 '16 at 9:19

I think everyone is still getting their heads around how to get 3rd party scripts into Magento 2, but when I needed to get Colorbox into a recent project I had to wrap the file in a require statement. Inside the colorbox.js file:

], function ($) {

...the default file content...


From what I understand, you should be able to use a shim in your requirejs-config.js which would be the require's way of wrapping up the colorbox file, but when I tried to use that solution, it didn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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