File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
app/code/Magento/Swatches/view/frontend/web/js Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 66define ( [
77 'jquery' ,
88 'underscore' ,
9+ 'mage/gallery/preloadImages' ,
910 'jquery/ui'
10- ] , function ( $ , _ ) {
11+ ] , function ( $ , _ , preloadImages ) {
1112 'use strict' ;
1213
1314 /**
@@ -268,6 +269,27 @@ define([
268269 'img' : $main . find ( '.product-image-photo' ) . attr ( 'src' )
269270 } ] ;
270271 }
272+ this . _preloadSwatchesImages ( ) ;
273+ } ,
274+
275+ /**
276+ * Preloads optional configuration images.
277+ * @private
278+ */
279+ _preloadSwatchesImages : function ( ) {
280+ var options = this . options ;
281+
282+ _ . each ( options . jsonConfig . images , function ( array ) {
283+ var fullImagesList = [ ] ,
284+ imagesList = [ ] ;
285+
286+ _ . each ( array , function ( item ) {
287+ imagesList . push ( item . img ) ;
288+ fullImagesList . push ( item . full ) ;
289+ } ) ;
290+ preloadImages ( imagesList ) ;
291+ preloadImages ( fullImagesList ) ;
292+ } ) ;
271293 } ,
272294
273295 /**
You can’t perform that action at this time.
0 commit comments