Skip to content

Commit c0b33b6

Browse files
committed
JS-334: Layout "jumps" on refresh while gallery is loading
- fix jumping content while gallery loading
1 parent 8bc6448 commit c0b33b6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@
2020
</div>
2121
</div>
2222
</div>
23+
<!--Fix for jumping content. Loader must be the same size as gallery.-->
2324
<script type="text/javascript">
2425
var config = {
2526
"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"); ?>",
2630
"height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height'); ?>
2731
},
32+
thumbBarHeight = 0,
2833
loader = document.querySelectorAll('[data-gallery-role="gallery-placeholder"] [data-role="loader"]')[0];
2934

35+
if (config.navtype === 'horizontal') {
36+
thumbBarHeight = config.thumbheight;
37+
}
38+
3039
loader.style.paddingBottom = ( config.height / config.width * 100) + "%";
3140
</script>
3241
<script type="text/x-magento-init">

lib/web/mage/gallery/gallery.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@
966966
.gallery-placeholder {
967967
.loading-mask {
968968
padding: 0 0 50%;
969-
position: absolute;
969+
position: static;
970970
}
971971
.loader img {
972972
position: absolute;

0 commit comments

Comments
 (0)