javascript - Rel=0 and autoplay=1 in YouTube embed player in magnific popup not working -
i'm having problems having both rel=0 , autoplay=1 added in youtube embedded player in magnific popup.
it seems first parameter in url working, , have tried these versions:
?rel=0&autoplay=1 ?rel=0&autoplay=1 ?rel=0?autoplay=1
none of them working. if move autoplay=1 first parameter, autoplay works fine - rel=0 doesn't.
here's code.
html:
<a class="video1" href="https://www.youtube.com/watch?v=_ziuhnerfmi?rel=0&autoplay=1"></a>
css:
.video1 { background-image: url('http://placehold.it/180x180'); background-repeat: no-repeat; background-size: contain; height: 180px; width: 180px; display: block; outline: none; }
js:
jquery(document).ready(function ($) { $('.video1').magnificpopup({ type: 'iframe', iframe: { markup: '<?php echo $first; ?>'+ '<div class="mfp-iframe-scaler">'+ '<div class="mfp-close"></div>'+ '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+ '</div>' }, callbacks: { markupparse: function(template, values, item) { values.title = item.el.attr('title'); } } }); });
this seems work fine:
jquery(document).ready(function ($) { $('.video1').magnificpopup({ items: { src: '<iframe width="560" height="315" src="https://www.youtube.com/embed/_ziuhnerfmi?autoplay=1&rel=0" frameborder="0" allowfullscreen></iframe>', type: 'inline' } }); });
.video1 { background-image: url('http://placehold.it/180x180'); background-repeat: no-repeat; background-size: contain; height: 180px; width: 180px; display: block; outline: none; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/jquery.magnific-popup.min.js"></script> <a class="video1" href="https://www.youtube.com/watch?v=_ziuhnerfmi"></a>
Comments
Post a Comment