2017-02-07 5 views
0

私は現在、他のビデオが左側にあり、メインビデオが右側に表示されているスライダを持つモーダルボックスを作成しようとしています。基本的にはhttp://imgur.com/a/vlkkRです。また、より多くの動画を実装するためのスクロール効果を追加しようとすると、すべてがYouTubeから埋め込まれます。しかし、私はそれを行う方法が完全にはわかっていない、モーダルウィンドウをポップして作業しているが、私がそこに現われたようにビデオを表示する方法がわからない。
HTML:モーダルを表示するカスタマイズされたビデオを作成しますか?

<div id="myModal" class="modal"> 

      <!-- Modal content --> 
      <div class="modal-content"> 
       <div class="modal-header text-center"> 
       <span class="close">&times;</span> 
       <h2>Долна Част</h2> 
       </div> 
       <div class="modal-body"> 
       <p>Some text in the Modal Body</p> 
       <iframe width="560" height="315" src="https://www.youtube.com/embed/yIyqdgQILvQ" frameborder="0" allowfullscreen></iframe> 
       </div> 
       <div class="modal-footer footer-size"> 
       <h3>Modal Footer</h3> 
       </div> 
      </div> 
      </div> 

CSS:

/* The Modal (background) */ 
        .modal { 
         display: none; /* Hidden by default */ 
         position: fixed; /* Stay in place */ 
         z-index: 1; /* Sit on top */ 
         left: 0; 
         top: 0; 
         width: 100%; /* Full width */ 
         height: 100%; /* Full height */ 
         overflow: auto; /* Enable scroll if needed */ 
         background-color: rgb(0,0,0); /* Fallback color */ 
         background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ 
        } 


        .modal-content { 
         background-color: #fefefe; 
         margin: 15% auto; 
         padding: 20px; 
         border: 1px solid #888; 
         width: 80%; 
        } 

        .close { 
         color: #aaa; 
         float: right; 
         font-size: 28px; 
         font-weight: bold; 
        } 

        .close:hover, 
        .close:focus { 
         color: black; 
         text-decoration: none; 
         cursor: pointer; 
        } 




        .modal { 
         display: none; 
         position: fixed; 
         z-index: 1; 
         padding-top: 100px; 
         left: 0; 
         top: 0; 
         width: 100%; 
         height: 100%; 
         overflow: auto; 
         background-color: rgb(0,0,0); 
         background-color: rgba(0,0,0,0.4); 
        } 


        .modal-content { 
         position: relative; 
         background-color: #fefefe; 
         margin: auto; 
         padding: 0; 
         border: 1px solid #888; 
         width: 80%; 
         box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); 
         -webkit-animation-name: animatetop; 
         -webkit-animation-duration: 0.4s; 
         animation-name: animatetop; 
         animation-duration: 0.4s 
        } 


        @-webkit-keyframes animatetop { 
         from {top:-300px; opacity:0} 
         to {top:0; opacity:1} 
        } 

        @keyframes animatetop { 
         from {top:-300px; opacity:0} 
         to {top:0; opacity:1} 
        } 

        .close { 
         color: white; 
         float: right; 
         font-size: 28px; 
         font-weight: bold; 
        } 

        .close:hover, 
        .close:focus { 
         color: #000; 
         text-decoration: none; 
         cursor: pointer; 
        } 

        .modal-header { 
         padding: 2px 16px; 
         background-color: #028fcc; 
         color: white; 
        } 

        .modal-body {padding: 2px 16px;} 

        .modal-footer { 
         padding: 2px 16px; 
         background-color: #028fcc; 
         color: white; 
        } 

JS:

// Get the modal 
    var modal = document.getElementById('myModal'); 

    // Get the button that opens the modal 
    var btn = document.getElementById("myBtn"); 

    // Get the <span> element that closes the modal 
    var span = document.getElementsByClassName("close")[0]; 

    // When the user clicks the button, open the modal 
    btn.onclick = function() { 
     modal.style.display = "block"; 
    } 

    // When the user clicks on <span> (x), close the modal 
    span.onclick = function() { 
     modal.style.display = "none"; 
    } 

    // When the user clicks anywhere outside of the modal, close it 
    window.onclick = function(event) { 
     if (event.target == modal) { 
      modal.style.display = "none"; 
     } 
    } 

答えて

0

は、ここにあなたが使用する必要がマークアップとfiddleです。
コピー貼り付けのコードが多すぎますので、回答にコードは含めません。
基本的にはfloatmenucontentの両方です。モーダルヘッダーとフッターの調整も追加しました。

関連する問題