Fix stretching of image on mobile

This commit is contained in:
Kijin Sung 2025-09-30 22:35:10 +09:00
parent 653ca4f697
commit 32c9c91b82

View file

@ -232,6 +232,7 @@ var initPhotoSwipeFromDOM = function(gallerySelector) {
var regx_skip = /(?:(modules|addons|classes|common|layouts|libs|widgets|widgetstyles)\/)/i;
var regx_allow_i6pngfix = /(?:common\/tpl\/images\/blank\.gif$)/i;
var isMobile = String(navigator.userAgent).match(/mobile/i);
var galleryImgEls = $(galleryElements[i]).find(ps_find_selector);
for(var j = 0, jl = galleryImgEls.length; j < jl; j++) {
// skip components
@ -240,6 +241,11 @@ var initPhotoSwipeFromDOM = function(gallerySelector) {
//$(galleryImgEls[j]).attr('data-pswp-uid', i+1);
$(galleryImgEls[j]).attr('data-pswp-pid', j+1);
// Fix stretching of image on mobile
if (isMobile) {
galleryImgEls[j].style.height = 'auto';
galleryImgEls[j].height = null;
}
}
}