Created
February 14, 2016 16:39
-
-
Save lots0logs/a872a44f31d8bf50163d to your computer and use it in GitHub Desktop.
WordPress :: Divi Builder :: Pause Background Video Until It Is In The Viewport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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