javascript - Is there any way to close Magnific when a Vimeo video has finished playing? -


hoping can me. have magnific iframe popup plays vimeo video. however, once finished, i'd automatically close popup. possible via plugin?

my current (working code):

$vimeo.magnificpopup({      closebtninside: false,     showclosebtn: false,     disableon: 0,     type: 'iframe',     mainclass: 'mfp-fade',     removaldelay: 0,     preloader: true,     fixedcontentpos: false,     callbacks: {          beforeopen: function() {             cache.$main.addclass('playing');         },          open: function() {                 $(this.curritem.el).closest('.project__item').toggleclass('playing');         },          close: function() {             $('.project__item').removeclass('playing');         },          afterclose: function() {             cache.$main.removeclass('playing');         }      }  }); 

i have searched web , official magnific api documentation no success.

any or nod in right direction appreciated.

many thanks, mikey.

add iframe markup:

$vimeo.magnificpopup({      closebtninside: false,     showclosebtn: false,     disableon: 0,     type: 'iframe',     mainclass: 'mfp-fade',     removaldelay: 0,     preloader: true,     fixedcontentpos: false,      iframe: {   markup: '<div class="mfp-iframe-scaler">'+             '<div class="mfp-close"></div>'+             '<iframe id="player1" class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+           '</div>', // html markup of popup, `mfp-close` replaced close button    patterns: {     youtube: {       index: 'youtube.com/', // string detects type of video (in case youtube). via url.indexof(index).        id: 'v=', // string splits url in 2 parts, second part should %id%       // or null - full url returned       // or function should return %id%, example:       // id: function(url) { return 'parsed id'; }         src: '//www.youtube.com/embed/%id%?autoplay=1' // url set source iframe.      },     callbacks: {          beforeopen: function() {             cache.$main.addclass('playing');         },          open: function() {                 $(this.curritem.el).closest('.project__item').toggleclass('playing');         },          close: function() {             $('.project__item').removeclass('playing');         },          afterclose: function() {             cache.$main.removeclass('playing');         }      }  }); 

add event player:

var iframe = $('#player1')[0]; var player = $f(iframe);  player.addevent('finish', onfinish); 

"onfinish" function close magnificpopup :

  var onfinish = function(){        $vimeo.magnificpopup.close();     } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -