Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- $(window).scroll(function() {
- $('.wp-video-shortcode').each(function() {
- var str = $(this).attr('id');
- var arr = str.split('-');
- typecheck = arr[0];
- if ($(this).is(":in-viewport") && typecheck == "video") {
- var video = new MediaElementPlayer($(this).attr('id'), {
- success: function(mediaElement) {
- $(this).attr('id')[0].player.pause();
- console.log($(this).attr('id') + 'video is playing');
- }
- });
- //$(this).[0].play();
- } else {
- //$(this).[0].pause();
- }
- });
- });
- });
- <video class="wp-video-shortcode" id="video-1115-1" width="792" height="470" poster="http://cdn.ultrasoundoftheweek.com/post_files/uotw16.1.jpg" loop="1" preload="none" controls="controls">
- <source type="video/mp4" src="http://cdn.ultrasoundoftheweek.com/post_files/uotw16.1.mp4?_=1" />
- <source type="video/webm" src="http://cdn.ultrasoundoftheweek.com/post_files/uotw16.1.webm?_=1" />
- </video>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement