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([
138
138
* @private
139
139
*/
140
140
_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 ) ) ;
145
144
} ,
146
145
147
146
/**
@@ -171,6 +170,14 @@ define([
171
170
}
172
171
} ,
173
172
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
+
174
181
/**
175
182
* Clear gallery events to prevent duplicated calls.
176
183
*
You can’t perform that action at this time.
0 commit comments