// window.addEventListener('scroll', checkScroll, false);
// window.addEventListener('resize', checkScroll, false);
//})
- $.fn.isOnScreen = function(){
-
- var win = $(window);
-
- var viewport = {
- top : win.scrollTop(),
- left : win.scrollLeft()
- };
- viewport.right = viewport.left + win.width();
- viewport.bottom = viewport.top + win.height();
-
- var bounds = this.offset();
- bounds.right = bounds.left + this.outerWidth();
- bounds.bottom = bounds.top + this.outerHeight();
-
- return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
-
- };
- $(window).on("load", function(){
- var video_visible = $("#wp-custom-header").isOnScreen();
- var clicked = false;
- var paused;
-
- if(!video_visible){
- $("#wp-custom-header-video-button").trigger('click');
- paused = true;
- console.log("PAUSED");
- } else {
- paused = false;
- console.log('PLAYING');
- }
-
- $(window).on("scroll", function(){
- 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;
- paused = false;
- console.log('PLAY');
- }
- else if(!video_visible && paused === false ){
- paused = true;
- $("#wp-custom-header-video-button").trigger('click');
- clicked = false;
- console.log( "PAUSE");
- } else {
- console.log("Nothing is happening");
- }
- })
- });
-
+// $.fn.isOnScreen = function(){
+//
+// var win = $(window);
+//
+// var viewport = {
+// top : win.scrollTop(),
+// left : win.scrollLeft()
+// };
+// viewport.right = viewport.left + win.width();
+// viewport.bottom = viewport.top + win.height();
+//
+// var bounds = this.offset();
+// bounds.right = bounds.left + this.outerWidth();
+// bounds.bottom = bounds.top + this.outerHeight();
+//
+// return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
+//
+// };
+// $(window).on("load", function(){
+// var video_visible = $("#wp-custom-header").isOnScreen();
+// var clicked = false;
+// var paused;
+//
+// if(!video_visible){
+// $("#wp-custom-header-video-button").trigger('click');
+// paused = true;
+// console.log("PAUSED");
+// } else {
+// paused = false;
+// console.log('PLAYING');
+// }
+//
+// $(window).on("scroll", function(){
+// 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;
+// paused = false;
+// console.log('PLAY');
+// }
+// else if(!video_visible && paused === false ){
+// paused = true;
+// $("#wp-custom-header-video-button").trigger('click');
+// clicked = false;
+// console.log( "PAUSE");
+// } else {
+// console.log("Nothing is happening");
+// }
+// })
+// });
});
// window.addEventListener('scroll', checkScroll, false);
// window.addEventListener('resize', checkScroll, false);
//})
- $.fn.isOnScreen = function(){
-
- var win = $(window);
-
- var viewport = {
- top : win.scrollTop(),
- left : win.scrollLeft()
- };
- viewport.right = viewport.left + win.width();
- viewport.bottom = viewport.top + win.height();
-
- var bounds = this.offset();
- bounds.right = bounds.left + this.outerWidth();
- bounds.bottom = bounds.top + this.outerHeight();
-
- return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
-
- };
- $(window).on("load", function(){
- var video_visible = $("#wp-custom-header").isOnScreen();
- var clicked = false;
- var paused;
-
- if(!video_visible){
- $("#wp-custom-header-video-button").trigger('click');
- paused = true;
- console.log("PAUSED");
- } else {
- paused = false;
- console.log('PLAYING');
- }
-
- $(window).on("scroll", function(){
- 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;
- paused = false;
- console.log('PLAY');
- }
- else if(!video_visible && paused === false ){
- paused = true;
- $("#wp-custom-header-video-button").trigger('click');
- clicked = false;
- console.log( "PAUSE");
- } else {
- console.log("Nothing is happening");
- }
- })
- });
-
+// $.fn.isOnScreen = function(){
+//
+// var win = $(window);
+//
+// var viewport = {
+// top : win.scrollTop(),
+// left : win.scrollLeft()
+// };
+// viewport.right = viewport.left + win.width();
+// viewport.bottom = viewport.top + win.height();
+//
+// var bounds = this.offset();
+// bounds.right = bounds.left + this.outerWidth();
+// bounds.bottom = bounds.top + this.outerHeight();
+//
+// return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
+//
+// };
+// $(window).on("load", function(){
+// var video_visible = $("#wp-custom-header").isOnScreen();
+// var clicked = false;
+// var paused;
+//
+// if(!video_visible){
+// $("#wp-custom-header-video-button").trigger('click');
+// paused = true;
+// console.log("PAUSED");
+// } else {
+// paused = false;
+// console.log('PLAYING');
+// }
+//
+// $(window).on("scroll", function(){
+// 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;
+// paused = false;
+// console.log('PLAY');
+// }
+// else if(!video_visible && paused === false ){
+// paused = true;
+// $("#wp-custom-header-video-button").trigger('click');
+// clicked = false;
+// console.log( "PAUSE");
+// } else {
+// console.log("Nothing is happening");
+// }
+// })
+// });
});