Advertisement
arsh999cg

jquery video popup autoplay and pause on close

Jan 28th, 2023 (edited)
962
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Video Popup
  2. jQuery(document).ready(function($){
  3.     $(".agencyb-hero-1-play").click(function(){
  4.         $(".agencyb-video-popup").fadeIn();
  5.         $(".agencyb-modal-video").trigger('play');
  6.     });
  7.  
  8.     if ($('.agencyb-modal-video').css('display') == 'block') {
  9.         $( document ).on( 'keydown', function ( e ) {
  10.             if ( e.keyCode === 27 ) { // ESC
  11.                 $(".agencyb-modal-video").trigger('pause');
  12.                 $(".agencyb-video-popup").fadeOut();
  13.             }
  14.         });
  15.     }
  16.  
  17.     $(".video-close").click(function(){
  18.         $(".agencyb-modal-video").trigger('pause');
  19.         $(".agencyb-video-popup").fadeOut();
  20.     });
  21. });
Advertisement
Comments
  • arsh999cg
    1 year
    # text 0.23 KB | 0 0
    1. This is the video code-block:
    2.  
    3. <video
    4. src="https://datenschutz-werk.de/wp-content/uploads/2023/01/Werk3-fur-Datenschutz.mp4"
    5. type="video/mp4"
    6. class="agencyb-modal-video"
    7. width="640"
    8. height="360">
    9. </video>
Add Comment
Please, Sign In to add comment
Advertisement