유투브 동영상 노출 시 자동 실행 또는 자동 종료 소스입니다.

· 11년 전 · 4972
유튜브 동영상 레이어 팝업에 넣은 후 자스로 제어하기
유투브 동영상 버튼 클릭 시 레이어 뜨면서 자동실행
또는 종료버튼 클릭 시 자동으로 종료하는 소스 입니다.

유튜브 동영상은 유튜브 주소에 autoplay=1을 하면 유튜브 동영상 노출 시 자동으로 동영상이 실행 되고
autoplay=0 하면 동영상 노출 시 동영상이 실행 되지 않는 것을 이용하여
레이어 팝업이 노출 되면 동영상 실행
레이어 팝업이 없어지면 동영상을 종료 하게 했습니다.

 <div id="Ulayer" style="width:560px;height:335px;visibility:hidden;position:absolute;left:200px;top:400px;">
            <span style="float:right;width:100px;height:20px;width:560px;text-align:right;padding-right:10px;font-weight:600;"><a href="javascript:;" onClick="UMOVEClose()">[닫기]</a></span>
           
<object width="560" height="315"><param  id="umove1"  name="movie" value="//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed id="umove2" src="//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
      

 </div>

style일 때문에 복잡해 보이지만  유튜브 소스는 object로 시작하는 부분이죠.

아래는 자스 소스에요

function UMOVE(){
    document.getElementById("Ulayer").style.visibility = "visible";
    document.getElementById("umove2").src = "//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=1";
    document.getElementById("umove1").src = "//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=1";
}
function UMOVEClose(){
    document.getElementById("Ulayer").style.visibility = "hidden";
    document.getElementById("umove2").src = "//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=0";
    document.getElementById("umove1").src = "//www.youtube.com/v/djkElboUs1I?version=3&amp;hl=ko_KR&autoplay=0";
}

아이프레임에 src 부분을 새로 넣어 줌으로
유투브 동영상을 시작과 종료를 할 수 있어요
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
11년 전 조회 2,151
11년 전 조회 2,481
11년 전 조회 1,144
11년 전 조회 3,006
11년 전 조회 3,176
11년 전 조회 1,739
11년 전 조회 2,404
11년 전 조회 1,245
11년 전 조회 1,583
11년 전 조회 1,283
11년 전 조회 2,489
11년 전 조회 2,382
11년 전 조회 1,357
11년 전 조회 5,487
11년 전 조회 2,535
11년 전 조회 3,254
11년 전 조회 2,110
11년 전 조회 1,155
11년 전 조회 2,215
11년 전 조회 2,365
11년 전 조회 2,047
11년 전 조회 1,656
11년 전 조회 1,164
11년 전 조회 2,030
11년 전 조회 2,786
11년 전 조회 1,484
11년 전 조회 2,995
11년 전 조회 1,938
11년 전 조회 4,694
11년 전 조회 2,028
11년 전 조회 2,690
11년 전 조회 3,915
11년 전 조회 1,795
11년 전 조회 2,637
11년 전 조회 1,014
11년 전 조회 2,045
11년 전 조회 4,679
11년 전 조회 1,825
11년 전 조회 2,055
11년 전 조회 964
11년 전 조회 1,363
11년 전 조회 1,687
11년 전 조회 1,801
11년 전 조회 1,670
11년 전 조회 2,434
11년 전 조회 1,366
11년 전 조회 3,278
11년 전 조회 3,465
11년 전 조회 2,016
11년 전 조회 4,973
11년 전 조회 1만
11년 전 조회 2,833
11년 전 조회 1,334
11년 전 조회 3,444
11년 전 조회 2,777
11년 전 조회 2,299
11년 전 조회 1,213
11년 전 조회 4,427
11년 전 조회 903
11년 전 조회 1,418
11년 전 조회 1,856
11년 전 조회 2,077
11년 전 조회 2,054
11년 전 조회 4,816
11년 전 조회 1,830
11년 전 조회 1,046
11년 전 조회 2,251
11년 전 조회 1,789
11년 전 조회 2,813
11년 전 조회 1,052
11년 전 조회 1,747
11년 전 조회 1,658
11년 전 조회 1,795
11년 전 조회 1,412
11년 전 조회 1,359
11년 전 조회 1,409
11년 전 조회 1,771
11년 전 조회 1,835
11년 전 조회 1,941
11년 전 조회 1,831
11년 전 조회 2,136
11년 전 조회 1,350
11년 전 조회 1,560
11년 전 조회 1,486
11년 전 조회 1,647
11년 전 조회 2,161
11년 전 조회 1,736
11년 전 조회 1,719
11년 전 조회 6,176
11년 전 조회 1,775
11년 전 조회 1,909
11년 전 조회 1,943
11년 전 조회 2,055
11년 전 조회 2,449
11년 전 조회 4,046
11년 전 조회 2,450
11년 전 조회 1,231
11년 전 조회 1,026
11년 전 조회 1,163
11년 전 조회 1,263
🐛 버그신고