This time I will share jQuery Plugin and tutorial about Minimal Youtube/Vimeo Modal Plugin For jQuery – modal-video, hope it will help you in programming stack.
A simple, accessible, customizable jQuery video lightbox plugin that allows to play Youtube/Vimeo videos in an animated modal window as you click on the video link.
Installation:
5 |
$ npm install modal-video --save |
How to use it:
1. Put both jQuery library and the jQuery modal-video plugin’s files at the bottom of the html page.
1 |
< script src = "//code.jquery.com/jquery-3.2.1.slim.min.js" ></ script > |
2 |
< script src = "modal-video.min.js" ></ script > |
3 |
< link rel = "stylesheet" href = "modal-video.min.css" > |
2. Create a video link and specify the video ID using the ‘data-video-id’ attribute as this:
1 |
< a href = "#" class = "js-video-button" data-video-id = 'NILlCqOqyNI' >Yotube Video</ a > |
3. Initialize the plugin and done.
1 |
$( ".js-video-button" ).modalVideo(); |
4. The plugin also works with Vimeo videos:
2 |
class = "js-video-button" |
3 |
data-video-id = '202177974' |
4 |
data-channel = "vimeo" >202177974 |
2 |
$( ".js-video-button" ).modalVideo({ |
5. Config the Youtube/Vimeo player:
01 |
$( ".js-video-button" ).modalVideo({ |
6. Config the video modal:
01 |
$( ".js-video-button" ).modalVideo({ |
02 |
allowFullScreen: true , |
05 |
modalVideo: 'modal-video' , |
06 |
modalVideoClose: 'modal-video-close' , |
07 |
modalVideoBody: 'modal-video-body' , |
08 |
modalVideoInner: 'modal-video-inner' , |
09 |
modalVideoIframeWrap: 'modal-video-movie-wrap' , |
10 |
modalVideoCloseBtn: 'modal-video-close-btn' |
13 |
openMessage: 'You just openned the modal video' , |
14 |
dismissBtnMessage: 'Close the modal by clicking here' |
Changelog:
2020-08-03
- Add the muted argument to the vimeo controls
2020-03-04
- v2.4.2: add allow=”autoplay” to iframe tag
2018-05-22
- v2.4.1: support playing video url
2018-04-10
- fix getfacebookurl method
2018-03-14
2018-03-13
2018-02-15
- v2.2.1: use getelementbyid method to find modal dialog
2017-10-13
2017-09-12
- v2.1.2: [fixed] option bug
2017-09-12
- v2.1.1: [added] data-channel option
This awesome jQuery plugin is developed by appleple. For more Advanced Usages, please check the demo page or visit the official website.