首页 > 解决方案 > Magento 2中的Fotorama画廊和放大镜问题

问题描述

我在 magento 2 中使用 Porto 主题。我在使用 fotorama 放大镜和 fotorama 画廊时卡住了。

放大镜: 在 fotorama 放大镜中,我将鼠标悬停在产品图像上,它显示 2 张图像。无法正确缩放

图库: 在图库中,我第一次想要 5 张图片,然后滚动我将能够在产品详细信息(查看)页面中看到另一张产品图片。

fotorama.js

 OPTIONS = {
itemdisp: 5,
             nav: 'dots', // 'thumbs' || false
            navposition: 'bottom', // 'top'
            navwidth: null,
            thumbwidth: THUMB_SIZE,
            thumbheight: THUMB_SIZE,
            thumbmargin: MARGIN,
            thumbborderwidth: MARGIN,

            allowfullscreen: false, // true || 'native'

            transition: 'slide', // 'crossfade' || 'dissolve'
            clicktransition: null,
            transitionduration: TRANSITION_DURATION,

            captions: true,

            startindex: 0,

            loop: false,

            autoplay: false,
            stopautoplayontouch: true,

            keyboard: false,

            arrows: true,
            click: true,
            swipe: false,
            trackpad: false,

            shuffle: false,

            direction: 'ltr', // 'rtl'

            shadows: true,

            showcaption: true,

            /**
             * Set type of thumbnail navigation
             */
            navdir: 'horizontal',

            /**
             * Set configuration to show or hide arrows in thumb navigation
             */
            navarrows: true,

            /**
             * Set type of navigation. Can be thumbs or slides
             */
            navtype: 'thumbs'

        },

在gallery.phtml中

"options": {
                "nav": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/nav"); ?>",

                "itemdisp":"<?php /* @escapeNotVerified */ echo $block->getVar("gallery/itemdisp"); ?>" /*my custom variable*/

在 view.xml 中

<var name="gallery">
        <var name="nav">thumbs</var> <!-- Gallery navigation style (false/thumbs/dots) -->
        <var name="itemdisp">5</var><!-- My custom variable -->

任何帮助将不胜感激。

谢谢你。

标签: phpmagento2fotorama

解决方案


推荐阅读