gpt4 book ai didi

javascript - 为什么这个简单的 jQuery 代码不起作用?

转载 作者:行者123 更新时间:2023-11-28 18:36:07 26 4
gpt4 key购买 nike

我不明白为什么这个简单的 jQuery 代码无法在我的浏览器中加载。这是简单的代码,应该显示可以关闭的 Angular 框。我认为代码没问题,但似乎 jQuery 未正确加载。提前致谢。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.kutija{
display: none;
border: 2px solid red;
height: 200px;
width = 200px;
position: absolute;
bottom: 0;
right: 0;
}
.close{
background-color: coral;
position: absolute;
top: 0;
right: 0;
height: 25px;
width: 25px;
text-align: center;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js">
$(document).ready(function(){
$(".close").click(function(){
$(".kutija").fadeOut;
});
$(".kutija").delay(2000).slideDown(1000);
});
</script>
</head>
<body>
<div class="kutija">
<div class="close">
X
</div>
<div>
Da li vam je potrebna pomoc?
</div>
</div>
</body>
</html>

最佳答案

fadeOut 是一个方法

 $(".kutija").fadeOut();

还为内容保留一个单独的脚本标记,并为下载 jquery 单独保留一个单独的脚本标记

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".close").click(function(){
$(".kutija").fadeOut();
});
$(".kutija").delay(2000).slideDown(1000);
});
</script>

根据 spec

If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI.

关于javascript - 为什么这个简单的 jQuery 代码不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37050892/

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