File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
app/code/Magento/Swatches/view/frontend/web/js Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1223,7 +1223,6 @@ define([
12231223 }
12241224
12251225 imagesToUpdate = this . _setImageIndex ( imagesToUpdate ) ;
1226-
12271226 if ( gallery === undefined ) {
12281227 context . find ( this . options . mediaGallerySelector ) . on ( 'gallery:loaded' , function ( loadedGallery ) {
12291228 loadedGallery = context . find ( this . options . mediaGallerySelector ) . data ( 'gallery' ) ;
@@ -1242,7 +1241,14 @@ define([
12421241 } ) ;
12431242 }
12441243
1245- gallery . first ( ) ;
1244+ if ( gallery === undefined ) {
1245+ context . find ( this . options . mediaGallerySelector ) . on ( 'gallery:loaded' , function ( loadedGallery ) {
1246+ loadedGallery = context . find ( this . options . mediaGallerySelector ) . data ( 'gallery' ) ;
1247+ loadedGallery . first ( ) ;
1248+ } . bind ( this ) ) ;
1249+ } else {
1250+ gallery . first ( ) ;
1251+ }
12461252
12471253 } else if ( justAnImage && justAnImage . img ) {
12481254 context . find ( '.product-image-photo' ) . attr ( 'src' , justAnImage . img ) ;
You can’t perform that action at this time.
0 commit comments