File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change 2525 text-align : center;
2626 }
2727 </ style >
28- < script >
29- function loadVideo ( element ) {
30- const iframe = element . querySelector ( 'iframe' ) ;
31- const src = iframe . getAttribute ( 'data-src' ) ;
32- iframe . src = src ;
33- }
34-
35- function handleIntersection ( entries ) {
36- entries . forEach ( ( entry ) => {
37- if ( entry . isIntersecting ) {
38- loadVideo ( entry . target ) ;
39- observer . unobserve ( entry . target ) ;
40- }
41- } ) ;
42- }
43-
44- const videoSections = document . querySelectorAll ( 'section' ) ;
45-
46- const options = {
47- root : null ,
48- rootMargin : '0px' ,
49- threshold : 0.1
50- } ;
51-
52- const observer = new IntersectionObserver ( handleIntersection , options ) ;
53-
54- videoSections . forEach ( ( section ) => {
55- observer . observe ( section ) ;
56- } ) ;
57- </ script >
5828</ head >
5929< body >
6030 < header >
You can’t perform that action at this time.
0 commit comments