채택완료

안녕하세요 팝업창에서 유트브 영상 정지하려면?

2023-03-17 (금) 15:52:39 2,187

안녕하세요 현재 이미지를 클릭하면 유트브팝업이 뜨도록 했는데

문제는 닫아도 영상 소리가 안꺼져서..검색으로 이리저리 적용하다가 안돼서

도움을 구합니다!

자바스크립트는 아래 처럼 되어 있는데요

이부분에 추가해서 해결 할수 있는 방법이 있을까요?

<script>

    ;(function($) {

        // DOM Ready

       $(function() {

           // Binding a click event

           // From jQuery v.1.7.0 use .on() instead of .bind()

           $('#my-button').bind('click', function(e) {

       var self = $(this) //button

       , content = $('.content');

       $('element_to_pop_up').bPopup({

           onOpen: function() {

               content.html(self.data('bpopup') || '');

           },

           onClose: function() {

               content.empty();

           }

       });

               // Prevents the default action to be triggered.

               e.preventDefault();

               // Triggering bPopup when click event is fired

               $('#element_to_pop_up').bPopup();

           });

       });

   })(jQuery);

</script>

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

           onClose: function() {

               content.empty();

           }

이부분을

           onClose: function() {

           content.empty();

          document.getElementById('iframeid값').contentWindow.postMessage( '{"event":"command", "func":"pauseVideo", "args":""}', '*');

           }

이렇게 해보실레요?

답변에 대한 댓글 1개

답변 감사합니다!

적용했는데 잘 안돼서 다행히

https://sir.kr/g5_skin/37707

이 소스로 해결했습니다!!

답변을 작성하려면 로그인이 필요합니다.