If we click on product image in the product details page, gallery full screen is coming to see the images in full screen.

I am trying to get the same functionality when click on my string Quick view in product details page added as an extension.

I have done so far:

I have added the below code in my template.

<span id="see_thumbnails" >Quick view</span>                      

<script type="text/javascript">
], function ($, gallery) {
    'use strict';
        $("#see_thumbnails").on("click" ,function() {




I am using openFullScreen because i found openFullScreen related code at vendor\magento\magento2-base\lib\web\mage\gallery\gallery.js

Can any one tell me where i am doing wrong.

Help would be appreciated.

  • may be you have to use this.openFullScreen() instead of gallery.openFullScreen(); Dec 22 '16 at 6:06
  • @Rakesh I am getting TypeError: this.openFullScreen is not a function Dec 22 '16 at 6:22
  • try with this ,var self = this; self.openFullScreen(); Dec 22 '16 at 6:23
  • @Rakesh throwing same error, i am adding external string, 'self' may not help. Dec 22 '16 at 6:27

After spending some time, i found the answer as mentioned below, hope this will help for someone.

    <script type="text/javascript">
    ], function ($, fotorama) {
        'use strict';
            $("#see_thumbnails").on("click" ,function() {       
                 var fotorama = $('.fotorama').fotorama({allowfullscreen: true}).data('fotorama');
                 var $fotoramaDiv = $('.fotorama').fotorama();
  • Do you know how I can check which is the current slide it's on? Yours will always open the first one as is.
    – Gezzasa
    Dec 4 '18 at 8:24
  • You are recreating the fotorama instance by doing this. Magento looses it and cannot control it anymore after that. Mar 28 '19 at 12:58
  • But close button can't display in fullscreen. Have an any idea? May 31 '19 at 12:37

You can also do this and trigger Magento 2's native behavior:


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.