File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 22* @Author : Alex Dong
33* @Date : 2020-07-29 13:21:07
44* @Last Modified by: Alex Dong
5- * @Last Modified time: 2020-08-27 22:40:56
5+ * @Last Modified time: 2021-02-02 19:35:42
66*/
77
88define ( [
@@ -17,7 +17,25 @@ define([
1717 } ,
1818
1919 _create : function ( ) {
20- this . _initSlider ( ) ;
20+ var options = this . options ;
21+ var self = this ;
22+ if ( "IntersectionObserver" in window ) {
23+ let gridSliderObserver = new IntersectionObserver ( function ( entries , observer ) {
24+ entries . forEach ( function ( entry ) {
25+ if ( entry . isIntersecting ) {
26+ // let el = entry.target;
27+ self . _initSlider ( ) ;
28+ gridSliderObserver . unobserve ( entry . target ) ;
29+ }
30+ } ) ;
31+ } ) ;
32+
33+ self . element . each ( function ( index , el ) {
34+ gridSliderObserver . observe ( el ) ;
35+ } ) ;
36+ } else {
37+ self . _initSlider ( ) ;
38+ }
2139 } ,
2240
2341 _uniqid : function ( a = "" , b = false ) {
@@ -61,6 +79,7 @@ define([
6179 } ) ;
6280 }
6381 el . on ( 'init' , function ( event , slick ) {
82+ $ ( 'body' ) . trigger ( 'contentUpdated' ) ; // support lazyload
6483 var video = $ ( this ) . find ( '.external-video' ) ;
6584 video . click ( function ( event ) {
6685 var $this = $ ( this ) ;
You can’t perform that action at this time.
0 commit comments