Commit fa63b526 by Galen Frechette

adds autoplaying to modal videos when opened, stops video playback when modal closes

parent 789d69d3
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
$('#lean_overlay').css({ 'display' : 'block', opacity : 0 }); $('#lean_overlay').css({ 'display' : 'block', opacity : 0 });
$('#lean_overlay').fadeTo(200,o.overlay); $('#lean_overlay').fadeTo(200,o.overlay);
$('iframe', modal_id).attr('src', $('iframe', modal_id).data('src'));
$(modal_id).css({ $(modal_id).css({
'display' : 'block', 'display' : 'block',
'position' : o.position, 'position' : o.position,
...@@ -52,10 +53,18 @@ ...@@ -52,10 +53,18 @@
function close_modal(modal_id){ function close_modal(modal_id){
$("#lean_overlay").fadeOut(200); $("#lean_overlay").fadeOut(200);
$('iframe', modal_id).attr('src', '');
$(modal_id).css({ 'display' : 'none' }); $(modal_id).css({ 'display' : 'none' });
} }
} }
}); });
})(jQuery);
$("a[rel*=leanModal]").leanModal({ top : 120, overlay: 1, closeButton: ".close-modal", position: 'absolute' }); $("a[rel*=leanModal]").each(function(){
$(this).leanModal({ top : 120, overlay: 1, closeButton: ".close-modal", position: 'absolute' });
embed = $($(this).attr('href')).find('iframe')
if(embed.length > 0) {
embed.data('src', embed.attr('src') + '?autoplay=1');
embed.attr('src', '');
}
});
})(jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment