问题描述:

I want the embedded video to load HIDE when the website loads.

Can you help me with this. thanks. Im not really good in programming so I need all the help, but i know basic stuff.

<!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>

网友答案:

You can use a delayed function.

I also think you may find your answer here Hide a div while page is loading?

jQuery

jQuery(window).load (function () { 
   jQuery('#DIV').removeClass('hidden_div')
});

CSS

div.hidden_div { display: none }

The following above will remove the class and therefor showing the element when page has finished loading.

网友答案:

You can do:

$("p iframe").hide();

Or just give it a style:

iframe {
    style: display: none;
}
相关阅读:
Top