Skip to content

Instantly share code, notes, and snippets.

@lots0logs
Created February 14, 2016 16:39
Show Gist options
  • Save lots0logs/a872a44f31d8bf50163d to your computer and use it in GitHub Desktop.
Save lots0logs/a872a44f31d8bf50163d 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