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 2
2
* @Author : Alex Dong
3
3
* @Date : 2020-07-29 13:21:07
4
4
* @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
6
6
*/
7
7
8
8
define ( [
@@ -17,7 +17,25 @@ define([
17
17
} ,
18
18
19
19
_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
+ }
21
39
} ,
22
40
23
41
_uniqid : function ( a = "" , b = false ) {
@@ -61,6 +79,7 @@ define([
61
79
} ) ;
62
80
}
63
81
el . on ( 'init' , function ( event , slick ) {
82
+ $ ( 'body' ) . trigger ( 'contentUpdated' ) ; // support lazyload
64
83
var video = $ ( this ) . find ( '.external-video' ) ;
65
84
video . click ( function ( event ) {
66
85
var $this = $ ( this ) ;
You can’t perform that action at this time.
0 commit comments