【发布时间】:2020-11-17 07:52:31
【问题描述】:
无论脚本的顺序如何,无论我尝试什么,GSAP 似乎都无法正常工作。我尝试了多种 jQuery 和 GSAP 变体。有人可以提供一个工作示例吗?
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
</head>
<body>
<div class = "gsap">
x
</div>
<button onclick = "gsap()">run gsap</button>
<script>
function gsap() {
gsap.to(".gsap", {duration: 2, x: 300});
}
</script>
</body>
</html>
【问题讨论】:
-
谢谢先生!
标签: javascript html gsap