当我试图展示一个iframe时,我遇到了一个问题。事情是这样的:首先,我在html5中加载一个视频,然后当视频完成后,用jquery隐藏视频并显示iframe (这是神秘的),但是由于某种原因,当视频隐藏时,iframe没有出现,当我检查元素时,标记在那里,但在src空中出现。
<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:
<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>想法?提前谢谢。
发布于 2012-09-10 23:47:23
您可以将小片段添加到functions.php中,这将使您能够轻松地显示iframes,甚至可以在post /页面中或直接在主题中设置大小。
在您的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"]'); ?>使用的属性:
。
希望这能有所帮助。
萨吉夫。
https://stackoverflow.com/questions/12359210
复制相似问题