2011-12-07 8 views
0

라이트 박스를 열었을 때 iframe (vimeo 범용 iframe 소스 코드)을 추가했지만 실행중인 애니메이션이 하나 더 있습니다 (즉, 화면 하단에서 슬라이드 아웃하는 설명).iframe 지연 추가 자바 스크립트 애니메이션

추가 할 때마다 iframe이 모든 리소스를 차지하고 있기 때문에 모든 것이 약간 멈춰있는 것 같습니다. 어떤 일이 일어나지 않도록 방지 할 방법이 있습니까?

iframe을 추가하지 않고 테스트하면 (검은 색 화면이 표시됨) 모든 것이 원활하게 실행됩니다. 이 애니메이션이 동시에 발생해야합니다.

답변

1

로드시 자동으로 비디오를 재생하지 않는 한 가장 좋은 방법은 비디오 자체 대신 이미지 만로드하는 것입니다.

$(document).ready(function() { 
    //Replace the url with an image 
    $(".video a").embedly({maxWidth: 500, 
         autoplay: true, 
         success : function(oembed, data){ 
         //replace the a tag with an image 
         var d = $('<a href="#" class="play"><span></span></a>') 
           .css('background-image', 'url('+oembed.thumbnail_url+')') 
           .data('oembed', oembed); 
         data.node.replaceWith(d); 
         } 
        }); 
    // When the user clicks play the video is loaded inline. 
    $('a.play').live('click', function(e){ 
     e.preventDefault(); 
     $(this).replaceWith($(this).data('oembed').html); 
    }); 
    }); 
: http://embedly.github.com/embedly-jquery/examples/autoplay.html

코드는 다음과 같은 : 여기

은 비디오 이미지와 자동 재생을 사용하는 대신로드의 예입니다