Reputation: 109
Currently I have lightgallery which working perfectly, but when I import additional plugin to it "lg-zoom.js" I'm getting error "property 'modules' of undefined".
In the functions.php I have:
wp_enqueue_script('lightgallery', get_template_directory_uri() . "/assets/vendor/lightgallery.min.js", array('jquery'), WEB_VERSION, false);
wp_enqueue_script('lg-zoom', get_template_directory_uri() . "/assets/vendor/lg-zoom.min.js", array('jquery'), WEB_VERSION, false);
Upvotes: 0
Views: 529
Reputation: 4534
Try adding the main lightgallery
script as a dependency to the lg-zoom
module:
wp_enqueue_script('lightgallery', get_template_directory_uri() . "/assets/vendor/lightgallery.min.js", array('jquery'), WEB_VERSION, false);
wp_enqueue_script('lg-zoom', get_template_directory_uri() . "/assets/vendor/lg-zoom.min.js", array('jquery', 'lightgallery'), WEB_VERSION, false); // 'jquery' could be even skipped here, since lightgallery already requires it.
Upvotes: 1