javascript - Magnific Popup: error trying to invoke a YouTube iframe popup from an inline popup -


i'm using magnific popup show inline modal image , text. client wants add link inside inline modal watch video - video being inside new modal popup.

we using video modal throughout site without problems, when link inside inline modal black overlay stays, inline modal goes away expected, no video modal appears.

<a class="modal-youtube" href="https://www.youtube.com/watch?v=5r15iunwhl8">watch video</a> 

in console has error:

error: syntax error, unrecognized expression: https://www.youtube.com/watch?v=5r15iunwhl8 

for reference, here's javascript code - it's pretty standard stuff docs, though.

$('.modal-youtube, .modal-vimeo, .modal-gmaps').magnificpopup({     disableon: 700,     type: 'iframe',     mainclass: 'mfp-fade',     removaldelay: 160,     preloader: false,      fixedcontentpos: false });    $('.modal').magnificpopup({         type: 'inline',         preloader: false,         showclosebtn: true   }); 

it sounds magnific popup having trouble rebuilding youtube link create iframe, have no idea why works everywhere else except inside modal window. ideas?

i'm brand new magnific-popup, , i'm experiencing same issue: youtube src doesn't build correctly. i'm not launching popup through <a> tag, rather on <div>. may not addressing situation, here's workaround idea you. i'm not crazy it, worked.

// store youtube url in data- attribute build page $(section_item).data("yt",thislink);  //section_item <div> magnific-popup spawns  $(section_item).magnificpopup({       items:{            src:$(section_item).data("yt")       },       type:'iframe',       callbacks:{            open:function({                 $("iframe").attr("src",$.magnificpopup.instance.curritem.src);            }       }, }); 

i seeing broken youtube src:

file://www.youtube.com/embed/ttps://www.youtube.com/embed/-fuullkmxxg?autoplay=1 

the open callback forced src corrected, it's chopped down, recalling curritem.src:

https://www.youtube.com/embed/-fuullkmxxg 

i tried playing patterns object, in documentation, couldn't work. hope little helpful.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -