我想先显示一个图像,然后我想显示网站内容

I want to show a image first then I want to show the site content

本文关键字:显示 然后 图像 网站 一个      更新时间:2023-09-26

假设我有一个名为a.html的页面和一张图片x。现在,当用户访问。html时,我想显示3/4的图片x然后我想显示页面内容。有人能帮我做这件事吗?

这是一个小代码,将使用纯js显示图像之前,显示网站的内容。我认为这类似于人们在加载内容之前显示加载图像。

<html>
<head>
    <title>Image before loading content</title>
</head>
<body onload="show();">
    <div id = "myDiv">
        <img id = "myImage" src = "http://jimpunk.net/Loading/wp-content/uploads/loading45.gif">
    </div>
    <div id="content" style="display: none;"> 
        This is a CONTENT SECTION Put your content here
    </div>
<script type = "text/javascript">
    function show() {
        document.getElementById("myDiv").style.display="block";
        setTimeout("hide()", 5000); // 5 wait, change the delay here
    }
    function hide() {
        document.getElementById("myDiv").style.display="none";
        document.getElementById("content").style.display="block";
    }
</script>
</body>

你可以把它放在一个HTML页面中,你应该能够看到我在哪里制作了图像以及延迟时间将在哪里发生。

下面是一个使用上述代码的工作示例:https://jsbin.com/pixemiwubu/edit?html,output