File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -358,9 +358,23 @@ <h3 id="example" class="title has-text-centered">
358358 </ div >
359359 </ div >
360360 < div class ="snippet snippet-plot has-text-centered " style ="background: white ">
361- < iframe src ="example.html " id ="iframe " loading ="lazy "
361+ < iframe data- src ="example.html " id ="iframe " loading ="lazy "
362362 style ="width:100%; margin-top:1em; height:566px; overflow:hidden; "
363363 data-ga-on ="wheel " data-ga-event-category ="iframe " data-ga-event-action ="wheel "> </ iframe >
364+ < noscript > JavaScript is required.</ noscript >
365+ < script >
366+ var iframe = document . getElementById ( 'iframe' ) ;
367+ if ( ! window . IntersectionObserver ) {
368+ window . addEventListener ( 'load' , ( ) => { iframe . src = iframe . dataset . src ; } ) ;
369+ } else {
370+ ( new IntersectionObserver ( ( entries , observer ) => {
371+ if ( entries [ 0 ] . intersectionRatio === 0 )
372+ return ;
373+ iframe . src = iframe . dataset . src ;
374+ observer . disconnect ( ) ;
375+ } , { threshold : .01 } ) ) . observe ( iframe ) ;
376+ }
377+ </ script >
364378 </ div >
365379
366380 < div class ="columns content is-centered is-vcentered has-text-centered " style ="margin-top:2em; ">
You canβt perform that action at this time.
0 commit comments