gpt4 book ai didi

javascript - JQuery 动画不起作用。可能语法不正确

转载 作者:行者123 更新时间:2023-11-28 11:17:11 24 4
gpt4 key购买 nike

我非常不明白为什么这个基本的 JQuery 代码不起作用,我只想在单击按钮时将此文本向右移动 500px。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0   Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src = "jquery-2.0.1.js"></script>
<script>
$(document).ready(function(){
$('button').click(function(){
$('div').animate({right:'500px'}, fast);
});
});

</script>
</head>

<body>

<div style = "position: absolute; top: 100px;">
Test Box
</div>
<button>click me</button>
</body>
</html>

最佳答案

在部分中:$('div').animate({right:'500px'}, fast); fast 必须是:"fast"
它对我有用!

关于javascript - JQuery 动画不起作用。可能语法不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16919885/

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