There is a video that is played in the pop-up window of the magnificPopup script. Question: why does the pop-up window appear when I click on the link and the video is played - everything is fine, but when I press the button there is no? How to make it so that when you press a button, everything works? Here fidl

$(".play-single").magnificPopup({ type: "iframe" }); $("#inpage_scroll_btn").magnificPopup({ type: "iframe" }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://rawgithub.com/dimsemenov/Magnific-Popup/master/dist/jquery.magnific-popup.js"></script> <link rel="stylesheet" href="https://rawgit.com/dimsemenov/Magnific-Popup/master/dist/magnific-popup.css"> <a href="https://vimeo.com/80836225" class="play-single">Play Single</a> <br/> <br /> <button id="inpage_scroll_btn" class="btn btn-primary standard-button inpage-scroll" onclick="parent.location='https://www.youtube.com/watch?v=DLihUyElkhM'">СМОТРЕТЬ</button> 

  • 2
    magnificPopup most likely uses this to get the link, you need to give it a context - splash58
  • @ splash58 thanks, but “most likely” will not suit me - I need to solve the problem) - Vasya
  • I would somehow do `$ (" # inpage_scroll_btn "). click (function () {$ (". play-single "). click ();})}); - splash58
  • one
    so try the proposed option - Grundy
  • one
    @ Vasya - what is he not working for? - jsfiddle.net/sqo6qppd/1 - splash58

1 answer 1

The solution is painfully simple - remove the onclick attribute from the button and insert src in the plugin parameters - fidl