Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save langlers/8efba41c1d636a070a7345e37f47fea7 to your computer and use it in GitHub Desktop.
Save langlers/8efba41c1d636a070a7345e37f47fea7 to your computer and use it in GitHub Desktop.
WordPress :: Divi Builder :: Pause Background Video Until It Is In The Viewport
<script>
(function($) {
$(window).load(function() {
var $fw_section = $('.custom_class');
$fw_section.waypoint({
handler: function(direction) {
$(this.element).find('video')[0].player.play();
},
offset: '50%'
});
setTimeout(function() {
$fw_section.find('video')[0].player.pause();
}, 1000);
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment