// if(!video_visible){
// $("#wp-custom-header-video-button").trigger('click');
// paused = true;
-// console.log("PAUSED");
// } else {
// paused = false;
-// console.log('PLAYING');
// }
//
+// console.log( $("#wp-custom-header-video-button").text());
// $(window).on("scroll", function(){
-// console.log(clicked, paused, video_visible);
-//
+//// console.log(clicked, paused, video_visible);
// video_visible = $("#wp-custom-header").isOnScreen();
-//
++
// if(video_visible && clicked === false && paused === true){
// $("#wp-custom-header-video-button").trigger('click');
// clicked = true;
// }
// })
// });
+
+ $(window).scroll(function() {
+ $("iframe").each( function() {
+ if( $(window).scrollTop() > $(this).offset().top - 200 ) {
+ $(this).css('opacity',1);
+ player.playVideo();
+ } else {
+ $(this).css('opacity',0);
+ player.stopVideo();
+ }
+ });
+ });
+
++
});
// if(!video_visible){
// $("#wp-custom-header-video-button").trigger('click');
// paused = true;
-// console.log("PAUSED");
// } else {
// paused = false;
-// console.log('PLAYING');
// }
//
+// console.log( $("#wp-custom-header-video-button").text());
// $(window).on("scroll", function(){
-// console.log(clicked, paused, video_visible);
-//
+//// console.log(clicked, paused, video_visible);
// video_visible = $("#wp-custom-header").isOnScreen();
-//
++
// if(video_visible && clicked === false && paused === true){
// $("#wp-custom-header-video-button").trigger('click');
// clicked = true;
// }
// })
// });
+
+ $(window).scroll(function() {
+ $("iframe").each( function() {
+ if( $(window).scrollTop() > $(this).offset().top - 200 ) {
+ $(this).css('opacity',1);
+ player.playVideo();
+ } else {
+ $(this).css('opacity',0);
+ player.stopVideo();
+ }
+ });
+ });
+
++
});