gpt4 book ai didi

javascript - 使用 jQuery 在页面加载时淡入 Web 元素

转载 作者:行者123 更新时间:2023-11-28 07:38:04 25 4
gpt4 key购买 nike

尝试获取一个主 Logo ,然后在加载此网页时获取一个淡入淡出的输入按钮。除了在代码之后取出 div 之外,还尝试了下面的代码,但没有成功。

有什么想法吗?提前谢谢你。

<!doctype html>
<html>
<head>

<title>The Webspace of Reality</title>

<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="style.css">

</head>
<body>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

<script>

$(function() {

$("#mainImage").hide().fadeIn("slow", function() {
$("#enterButton").hide().fadeIn("slow")
});
});

</script>
<div id="mainImage">
</div>
<div id="enterButton"></div>

</body>
</html>
#mainImage img {
width: 550px;
display: block;
position: static;
margin-right: auto;
margin-left: auto;
}

#enterButton button {
background-color: black;
font-family: Futura, Helvetica, sans-serif;
font-size: 28px;
border-radius: 10px;
height: 50px;
width: 200px;
color: white;
margin-right: auto;
margin-left: auto;
display: block;
position: static;
margin-top: 20px;
border-style: none;
}

最佳答案

您的问题出在 css 中。逗号添加在名称选择器之后:

#mainImage, img {
width: 550px;
display: block;
position: static;
margin-right: auto;
margin-left: auto;
}
#enterButton, button {
background-color: black;
font-family: Futura, Helvetica, sans-serif;
font-size: 28px;
border-radius: 10px;
height: 50px;
width: 200px;
color: white;
margin-right: auto;
margin-left: auto;
display: block;
position: static;
margin-top: 20px;
border-style: none;
}

希望这对您有所帮助。

关于javascript - 使用 jQuery 在页面加载时淡入 Web 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31118955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com