I am trying to add images product gallery to my custom widget using Fotorama. What it should look like: enter image description here

So I tried to initialize the gallery widget using the js script. Based on the info I got from https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/widgets/widget_gallery.html. But for some reason, it is not displaying correctly. Am I missing something here?

This is how it looks like: (It is display 3 images all at once instead just one image) enter image description here

Any idea on how can I fix this? Thanks

1 Answer 1


So I figured it out after days of trying to fix this. The problem is because there is a css file that is not loaded properly.

<link rel="stylesheet" type="text/css" href="<?php echo $block->getViewFileUrl('mage/gallery/gallery.css')?>">

Adding the above code to my custom phtml fixed the issue.

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.