File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
app/code/Magento/ProductVideo/view/frontend/web/js Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -138,10 +138,9 @@ define([
138138 * @private
139139 */
140140 _create : function ( ) {
141- $ ( this . element ) . on ( 'gallery:loaded' , $ . proxy ( function ( ) {
142- this . fotoramaItem = $ ( this . element ) . find ( '.fotorama-item' ) ;
143- this . _initialize ( ) ;
144- } , this ) ) ;
141+ $ ( this . element ) . data ( 'gallery' ) ?
142+ this . _onGalleryLoaded ( ) :
143+ $ ( this . element ) . on ( 'gallery:loaded' , this . _onGalleryLoaded . bind ( this ) ) ;
145144 } ,
146145
147146 /**
@@ -171,6 +170,14 @@ define([
171170 }
172171 } ,
173172
173+ /**
174+ * Callback which fired after gallery gets initialized.
175+ */
176+ _onGalleryLoaded : function ( ) {
177+ this . fotoramaItem = $ ( this . element ) . find ( '.fotorama-item' ) ;
178+ this . _initialize ( ) ;
179+ } ,
180+
174181 /**
175182 * Clear gallery events to prevent duplicated calls.
176183 *
You can’t perform that action at this time.
0 commit comments