Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p class="scrolldown">Video Play & Scroll Down <span> &#x21E9;</span></p>
<!-- <video class="video" width="100%" height="500">
        <source src="https://www.w3schools.com/tags/movie.mp4" type="video/mp4">
      </video>
<h1>Play Pause button on mouse hover for HTML <strong>Video</strong> tag and floating sticky video on page scroll while video in playing mode.
  This code will not be work on Iframe </h1>
      <video width="100%" height="500">
        <source src="https://ia800208.us.archive.org/4/items/Popeye_forPresident/Popeye_forPresident_512kb.mp4" type="video/mp4">
      </video>
<video width="100%" height="500">
        <source src="https://ia800208.us.archive.org/4/items/Popeye_forPresident/Popeye_forPresident_512kb.mp4" type="video/mp4">
      </video>-->


<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
      <video width="550">
				<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"> 
				Your browser does not support HTML5 video.
			</video>
		</div>
	</div>
	<div class="row first">
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
	</div>
	<div class="row second">
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
	</div>
	<div class="row third">
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
	</div>
	<div class="row fourth">
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
		<div class="col-md-4">
		</div>
	</div>
</div>
              
            
!

CSS

              
                .video-parent-class {
    margin: 0 auto;
}
.pause-play-img {
            position: absolute;
            /*top: 50%;*/
            z-index: 99;
            /*margin-top: -50px;*/
            left: 50%;
            display: none;
            opacity: 0.4;
            width: 64px;
        }

        .video-parent-class:hover img.pause-play-img {
            display: block;
        }

        .video-parent-class {
            position: relative;
        }

        /*Floating CSS Start*/

        @keyframes fade-in-up {
            0% {
                opacity: 0;
            }
            100% {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .stuck {
            position: fixed;
            bottom: 20px;
            right: 20px;
            transform: translateY(100%);
            width: 260px;
            height: 145px;
            animation: fade-in-up .25s ease forwards;
            z-index: 999;
        }

        /*Floating CSS End*/
p.scrolldown {
    width: 200px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    border: 1px solid;
    background: #ff7037;
    position: fixed;
    right: 75px;
    color: #fff;
    -webkit-animation-name: example; /* Safari 4.0 - 8.0 */
    -webkit-animation-duration: 4s; /* Safari 4.0 - 8.0 */
    animation-name: example;
    animation-duration: 2s;
}
.container-fluid {
    width: 600px;
}
.col-md-12 {
    padding-left: 0;
}
.col-md-4 {
    /* border: 1px solid; */
    padding: 13px;
    margin: 1%;
    height: 230px;
    width: 30%;
    max-width: 30%;
}
.first .col-md-4{
  background: #a72727;
}
.second .col-md-4{
  background: #313192;
}
.third .col-md-4{
 background: #31926a;
}
.fourth .col-md-4{
 background: #839231;
} 
              
            
!

JS

              
                var plugin_url = "https://plugins.svn.wordpress.org/play-pause-button-for-video/trunk";
  jQuery(document).ready(function() {
                if (jQuery("video").length > 0) {
                  jQuery("video").wrap("<div class='video-parent-class'></div>");
                  /*Add image just before to vedio  */
                    jQuery("<img class='pause-play-img' src='" + plugin_url + "/img/img01.png' >").insertBefore("video");
    jQuery("video").each(function(index) {
        /*vedio parent div height width code*/
                        var vedio_width = jQuery(this).width();
                        var vedio_height = jQuery(this).height();
                        jQuery(".video-parent-class").css({
                            "width": vedio_width + "px",
                            "height": vedio_height + "px"
                        });

                        /*Pause Play image, middle width in vedio code*/
                        var half_width_vedio = vedio_width / 2;
                        var middle_object_width = half_width_vedio - 32;
                        jQuery(".pause-play-img").css({
                            "left": middle_object_width + "px"
                        });

                        /*Pause Play image middle height in vedio code*/
                        var half_height_vedio = vedio_height / 2;
                        var middle_object_heigh = half_height_vedio - 32;
                        jQuery(".pause-play-img").css({
                            "top": middle_object_heigh + "px"
                        });

                        /*Pause play and image src change code*/
                        jQuery(this).on("click", function() {
                            if (this.paused) {
                                this.play();
                                jQuery(this).prev().attr("src", plugin_url + "/img/img02.png");
                            } else {
                                this.pause();
                                jQuery(this).prev().attr("src", plugin_url + "/img/img01.png");
                            }


                        });


                        /*pause play image click vedio on off functionlity code*/
                        jQuery(this).prev().on("click", function() {
                            var myVideo = jQuery(this).next()[0];
                            if (myVideo.paused) {

                                myVideo.play();
                                jQuery(this).attr("src", plugin_url + "/img/img02.png");
                            } else {

                                myVideo.pause();
                                jQuery(this).attr("src", plugin_url + "/img/img01.png");
                            }

                        });
                        /*Floating js for HTML Video Start*/
        var windows = jQuery(window);
                        var videoWrap = jQuery(this).parent();
                        var video = jQuery(this);
                        var videoHeight = video.outerHeight();
                        var videoElement = video.get(0);
                        windows.on('scroll', function() {
                            var windowScrollTop = windows.scrollTop();
                            var videoBottom = videoHeight + videoWrap.offset().top;
                            //alert(videoBottom);
                            
                                if ((windowScrollTop > videoBottom)) {
                                  if (!videoElement.paused) {
                                      videoWrap.height(videoHeight);
                                      video.addClass('stuck');
                                      if (video.hasClass('stuck')) {
                                        video.attr("controls","1");
                                      }
                                      video.prev().attr("src", plugin_url + "/img/img02.png");
                          jQuery(".scrolldown").css({"display": "none"});          
                                  }
                                  else {
                                      videoWrap.height('auto');
                                      video.removeClass('stuck');
                                      video.removeAttr('controls');
                                      if (videoElement.paused) {
                                        video.prev().attr("src", plugin_url + "/img/img01.png");
                                      }
                                  }

                                } 
                                else {
                                    videoWrap.height('auto');
                                    video.removeClass('stuck');
                                    video.removeAttr('controls');
                                }
                            
                        });
                         /*Floating js for HTML Video End*/
    });
    /*After end vedio change image*/
                    var video = document.getElementsByTagName('video')[0];

                    video.onended = function(e) {
                        jQuery(".pause-play-img").attr("src", plugin_url + "/img/img01.png");
                    };
  }
  });
              
            
!
999px

Console