Last active
July 17, 2018 18:11
-
-
Save fillipetech/f0df32c215b45e79b27db5abf38f88e4 to your computer and use it in GitHub Desktop.
Reset Video on Visible Viewport area #js #jquery #video
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
| /** | |
| * Reset video on visible area | |
| */ | |
| jQuery(document).ready(function($) { | |
| $(window).scroll(function() { | |
| $('video').each(function(){ | |
| if ($(this).is(":in-viewport")) { | |
| $(this)[0].play(); | |
| } else { | |
| $(this)[0].currentTime = 0; | |
| } | |
| }) | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment