|
20 | 20 | </div>
|
21 | 21 | </div>
|
22 | 22 | </div>
|
| 23 | +<!--Fix for jumping content. Loader must be the same size as gallery.--> |
| 24 | +<script> |
| 25 | + var config = { |
| 26 | + "width": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'width'); ?>, |
| 27 | + "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height') |
| 28 | + ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>, |
| 29 | + "navtype": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/navtype"); ?>", |
| 30 | + "height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height'); ?> |
| 31 | + }, |
| 32 | + thumbBarHeight = 0, |
| 33 | + loader = document.querySelectorAll('[data-gallery-role="gallery-placeholder"] [data-role="loader"]')[0]; |
| 34 | + |
| 35 | + if (config.navtype === 'horizontal') { |
| 36 | + thumbBarHeight = config.thumbheight; |
| 37 | + } |
| 38 | + |
| 39 | + loader.style.paddingBottom = ( config.height / config.width * 100) + "%"; |
| 40 | +</script> |
23 | 41 | <script type="text/x-magento-init">
|
24 | 42 | {
|
25 | 43 | "[data-gallery-role=gallery-placeholder]": {
|
|
29 | 47 | "data": <?php /* @escapeNotVerified */ echo $block->getGalleryImagesJson(); ?>,
|
30 | 48 | "options": {
|
31 | 49 | "nav": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/nav"); ?>",
|
32 |
| - "loop": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/loop"); ?>, |
33 |
| - "keyboard": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/keyboard"); ?>, |
34 |
| - "arrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/arrows"); ?>, |
35 |
| - "allowfullscreen": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/allowfullscreen"); ?>, |
36 |
| - "showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/caption"); ?>, |
37 |
| - "width": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'width'); ?>, |
38 |
| - "thumbwidth": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'width'); ?>, |
39 |
| - "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height') |
| 50 | + <?php if (($block->getVar("gallery/loop"))): ?> |
| 51 | + "loop": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/loop"); ?>, |
| 52 | + <?php endif; ?> |
| 53 | + <?php if (($block->getVar("gallery/keyboard"))): ?> |
| 54 | + "keyboard": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/keyboard"); ?>, |
| 55 | + <?php endif; ?> |
| 56 | + <?php if (($block->getVar("gallery/arrows"))): ?> |
| 57 | + "arrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/arrows"); ?>, |
| 58 | + <?php endif; ?> |
| 59 | + <?php if (($block->getVar("gallery/allowfullscreen"))): ?> |
| 60 | + "allowfullscreen": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/allowfullscreen"); ?>, |
| 61 | + <?php endif; ?> |
| 62 | + <?php if (($block->getVar("gallery/caption"))): ?> |
| 63 | + "showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/caption"); ?>, |
| 64 | + <?php endif; ?> |
| 65 | + "width": "<?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'width'); ?>", |
| 66 | + "thumbwidth": "<?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'width'); ?>", |
| 67 | + <?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?> |
| 68 | + "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height') |
40 | 69 | ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>,
|
41 |
| - "height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height') |
| 70 | + <?php endif; ?> |
| 71 | + <?php if ($block->getImageAttribute('product_page_image_medium', 'height') || $block->getImageAttribute('product_page_image_medium', 'width')): ?> |
| 72 | + "height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height') |
42 | 73 | ?: $block->getImageAttribute('product_page_image_medium', 'width'); ?>,
|
43 |
| - "transitionduration": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/transition/duration"); ?>, |
| 74 | + <?php endif; ?> |
| 75 | + <?php if ($block->getVar("gallery/transition/duration")): ?> |
| 76 | + "transitionduration": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/transition/duration"); ?>, |
| 77 | + <?php endif; ?> |
44 | 78 | "transition": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/transition/effect"); ?>",
|
45 |
| - "navarrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/navarrows"); ?>, |
| 79 | + <?php if (($block->getVar("gallery/navarrows"))): ?> |
| 80 | + "navarrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/navarrows"); ?>, |
| 81 | + <?php endif; ?> |
46 | 82 | "navtype": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/navtype"); ?>",
|
47 | 83 | "navdir": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/navdir"); ?>"
|
48 | 84 | },
|
49 | 85 | "fullscreen": {
|
50 | 86 | "nav": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/nav"); ?>",
|
51 |
| - "loop": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/loop"); ?>, |
| 87 | + <?php if ($block->getVar("gallery/fullscreen/loop")): ?> |
| 88 | + "loop": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/loop"); ?>, |
| 89 | + <?php endif; ?> |
52 | 90 | "navdir": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/navdir"); ?>",
|
53 |
| - "arrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/arrows"); ?>, |
54 |
| - "showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/caption"); ?>, |
55 |
| - "transitionduration": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/transition/duration"); ?>, |
| 91 | + <?php if ($block->getVar("gallery/transition/navarrows")): ?> |
| 92 | + "navarrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/navarrows"); ?>, |
| 93 | + <?php endif; ?> |
| 94 | + "navtype": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/navtype"); ?>", |
| 95 | + <?php if ($block->getVar("gallery/fullscreen/arrows")): ?> |
| 96 | + "arrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/arrows"); ?>, |
| 97 | + <?php endif; ?> |
| 98 | + <?php if ($block->getVar("gallery/fullscreen/caption")): ?> |
| 99 | + "showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/caption"); ?>, |
| 100 | + <?php endif; ?> |
| 101 | + <?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?> |
| 102 | + "transitionduration": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/transition/duration"); ?>, |
| 103 | + <?php endif; ?> |
56 | 104 | "transition": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery/fullscreen/transition/effect"); ?>"
|
57 | 105 | },
|
58 | 106 | "breakpoints": <?php /* @escapeNotVerified */ echo $block->getBreakpoints(); ?>
|
|
0 commit comments