我希望嵌入的视频加载隐藏时,网站加载。
你能帮我解决这个吗?谢谢。我不是真正擅长编程,所以我需要所有的帮助,但我知道基本的东西。
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
$("p").slideUp();
});
$(".btn2").click(function(){
$("p").slideDown();
});
});
</script>
</head>
<body>
<p><iframe width="420" height="315" src="//www.youtube.com/embed/b8B1O0Fak5s" frameborder="0" allowfullscreen></iframe></p>
<button class="btn1">Slide up</button>
<button class="btn2">Slide down</button>
</body>
</html>
发布于 2014-03-31 21:45:03
您可以使用延迟函数。
我也认为你可以在这里找到你的答案Hide a div while page is loading?
jQuery
jQuery(window).load (function () {
jQuery('#DIV').removeClass('hidden_div')
});
CSS
div.hidden_div { display: none }
下面的代码将删除类,并在页面加载完成时显示元素。
发布于 2014-03-31 21:45:46
您可以执行以下操作:
$("p iframe").hide();
或者只是给它一个风格:
iframe {
style: display: none;
}
https://stackoverflow.com/questions/22763153
复制相似问题