2012-09-10 4 views
0

iframe을 표시하려고 할 때 문제가 있습니다. 여기에 html5로 비디오를로드하고 나서 비디오가 비디오를 숨기고 비디오를 숨기고 jQuery로 iframe div (오컬트)를 표시하지만 비디오가 iframe을 숨길 때 어떤 이유로 나타나면 요소를 검사 할 때 태그가 있지만 src가 비어있는과 함께 나타납니다.Wordpress에서 iframe 표시

<div id="video-promo"> 
    <video width="680" height="371" id="video" autoplay="autoplay"> 
     <source src="/video/first_test.m4v" type="video/mp4" /> 
    </video> 
</div> 

<div id="video-streaming" style="display:none;"> 
    <iframe width="560" height="315" src="http://www.youtube.com/embed/FmxSk0wZxss" frameborder="0" allowfullscreen></iframe> 
</div> 

아이디어 :

<script src="http://code.jquery.com/jquery-latest.js"></script> 
<script type="text/javascript" charset="utf-8"> 
jQuery(document).ready(function() {  
    jQuery("#video").bind("ended", function() {    
     jQuery("#video-promo").hide();      
     jQuery("#video-streaming").show();  
     });    
}); 
</script> 

그리고 여기에는 HTML을 간다? 미리 감사드립니다.

+0

'display : none'을 제거하고'jQuery ('video-streaming'). hide()'를'jQuery (document) .ready' 이벤트에 넣으면 처음에는 숨길 수 있습니다. –

+0

아직 작동하지 않습니다. 여기에있는 것은 숨기기 및 표시 이벤트가 작동하지만 요소를 검사 할 때 다음과 같이 표시됩니다. ' ' – Andres

답변

0

쉽게 iframe을 표시 할 수 있습니다, 심지어 당신의 functions.php에 테마

에 직접 글/페이지 내에서 크기를 설정하거나 것이다 당신의 functions.php에 작은 조각을 추가 (또는 포함 할 수 파일) :

function myiframe($atts) { 
    extract(shortcode_atts(array(
     'href' => 'http://the-url', 
     'height' => '550px', 
     'width' => '600px',  
    ), $atts)); 

    return '<iframe src="'.$href.'" width="'.$width.'" height="'.$height.'"> <p>Your Browser does not support Iframes.</p></iframe>'; 
} 
add_shortcode('iframe', 'myiframe'); 

. 직접 게시물/페이지에서
- 사용 방법 :

[iframe href="http://www.exmaple.com" height="480" width="640"] 

. 테마에서 직접
- 사용 방법 : 사용

<?php do_shortcode('[iframe href="http://www.exmaple.com" height="480" width="640"]'); ?> 

속성 :

  1. HREF =은 iframe의 소스
  2. 높이 =은 iframe의 높이 (당신은 기본적를 설정할 수 있습니다 함수)
  3. 너비 = iframe의 너비 (함수에서 기본값을 설정할 수 있습니다)

.
희망이 도움이됩니다.
Sagive.

관련 문제