0

I have written jQuery code to pause and play a video. Here I have used the embed tag (not the video tag). It's working in Chrome but not in Firefox.

jQuery( document ).ready(function(){
    jQuery( document ).scroll(function() {    
        jQuery(".entry-content .wonderplugingallery").each(function(index){     
            var eTop = jQuery('.entry-content .html5gallery-container-'+index).offset().top;    
            var topy = eTop - jQuery(window).scrollTop();        
            if(topy>80 && topy<340){        
                jQuery(".html5gallery-container-"+index+" .html5gallery-video-play-"+index).trigger("click");
                jQuery(".html5gallery-container-"+index+" .html5boxPlayPause .html5boxPlay").trigger("click");          
            }else{          
                jQuery(".html5gallery-container-"+index+" .html5boxPlayPause .html5boxPause").trigger("click");
            }
        });
    });
});
moopet
  • 6,014
  • 1
  • 29
  • 36
vasudev
  • 410
  • 5
  • 13

1 Answers1

-1

refer the code and live example in this link

How to pause html5 video when out of view code (non-statically positioned)

    parent = video;
while (parent && parent !== document.body) {
x += parent.offsetLeft;
y += parent.offsetTop;
parent = parent.offsetParent;}
Community
  • 1
  • 1
gokul
  • 74
  • 7